diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-08-13 23:24:50 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-08-13 23:24:50 +0000 |
commit | 9e6862623370f53d1b78e4bd167152b840e28884 (patch) | |
tree | 21071f17a775b101163dabc31e6aeefedf199c12 /src/net/network.cpp | |
parent | afc770043be553998555e9ac1cffca68dc482d48 (diff) | |
download | mana-9e6862623370f53d1b78e4bd167152b840e28884.tar.gz mana-9e6862623370f53d1b78e4bd167152b840e28884.tar.bz2 mana-9e6862623370f53d1b78e4bd167152b840e28884.tar.xz mana-9e6862623370f53d1b78e4bd167152b840e28884.zip |
Verify the gender to prevent crashing when something is wrong with the communication.
Diffstat (limited to 'src/net/network.cpp')
-rw-r--r-- | src/net/network.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/net/network.cpp b/src/net/network.cpp index f18cf412..dcfbc8f1 100644 --- a/src/net/network.cpp +++ b/src/net/network.cpp @@ -146,12 +146,16 @@ void Network::dispatchMessages() MessageHandlerIterator iter = mMessageHandlers.find(msg.getId()); - printf("Received packet: %x\n", msg.getId()); - - if (iter != mMessageHandlers.end()) + if (iter != mMessageHandlers.end()) { + logger->log("Received packet %x (%i B)", + msg.getId(), msg.getLength()); iter->second->handleMessage(&msg); - else - logger->log("Unhandled packet: %x", msg.getId()); + } + else { + logger->log("Unhandled packet %x (%i B)", + msg.getId(), msg.getLength()); + } + mIncomingPackets.pop(); // Clean up the packet now that we're done using it. enet_packet_destroy(packet); |