Fixed a bug in deserializePacket()

This commit is contained in:
Kayne Ruse
2014-11-26 07:51:24 +11:00
parent 01461deaa5
commit 584b6ea303
2 changed files with 10 additions and 2 deletions
+9 -1
View File
@@ -163,10 +163,18 @@ void ServerApplication::Init(int argc, char* argv[]) {
void ServerApplication::Proc() {
SerialPacket* packetBuffer = reinterpret_cast<SerialPacket*>(new char[MAX_PACKET_SIZE]);
memset(packetBuffer, 0, MAX_PACKET_SIZE); //zero the buffer
while(running) {
//suck in the waiting packets & process them
while(UDPNetworkUtility::GetSingleton().Receive(packetBuffer)) {
HandlePacket(packetBuffer);
try {
HandlePacket(packetBuffer);
}
catch(std::exception& e) {
std::cerr << "HandlePacket Error: " << e.what() << std::endl;
}
memset(packetBuffer, 0, MAX_PACKET_SIZE); //reset the buffer
}
//update the internals
//...