void Handshake::packetHandler(PacketReader& packet) { UInt8 marker = packet.read8(); if(marker!=0x0b) { ERROR("Marker handshake wronk : must be '0B' and not '%02x'",marker); return; } UInt16 time = packet.read16(); UInt8 id = packet.read8(); packet.shrink(packet.read16()); // length PacketWriter& packetOut = writer(); UInt8 idResponse=0; { PacketWriter response(packetOut,3); idResponse = handshakeHandler(id,packet,response); if(idResponse==0) return; } packetOut << (UInt8)idResponse; packetOut << (UInt16)(packetOut.length()-packetOut.position()-2); send(true); // reset farid to 0! _farId=0; }
void Handshake::packetHandler(PacketReader& packet) { UInt8 marker = packet.read8(); if(marker!=0x0b) { ERROR("Marker handshake wrong : should be 0b and not %u",marker); return; } UInt16 time = packet.read16(); UInt8 id = packet.read8(); packet.shrink(packet.read16()); // length PacketWriter& response(writer()); UInt32 pos = response.position(); response.next(3); UInt8 idResponse = handshakeHandler(id,packet,response); response.reset(pos); if(idResponse>0) { response.write8(idResponse); response.write16(response.length()-response.position()-2); flush(); } // reset farid to 0! (UInt32&)farId=0; }