summaryrefslogtreecommitdiff
path: root/src/net/network.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-01-22 19:26:32 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-01-22 19:26:32 +0000
commitbfedebb8069e4613c96a53151e72785ea7352765 (patch)
treeb0be95e79eb9f1066c2d16c39c16d370eab0b113 /src/net/network.cpp
parentfafb16bfcbdafa78ca6b587090838cf9752313e5 (diff)
downloadmana-bfedebb8069e4613c96a53151e72785ea7352765.tar.gz
mana-bfedebb8069e4613c96a53151e72785ea7352765.tar.bz2
mana-bfedebb8069e4613c96a53151e72785ea7352765.tar.xz
mana-bfedebb8069e4613c96a53151e72785ea7352765.zip
Make dispatchMessages actually handle more than one message per call.
Diffstat (limited to 'src/net/network.cpp')
-rw-r--r--src/net/network.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/net/network.cpp b/src/net/network.cpp
index 3b0652e2..f519a467 100644
--- a/src/net/network.cpp
+++ b/src/net/network.cpp
@@ -214,20 +214,20 @@ void Network::clearHandlers()
void Network::dispatchMessages()
{
- if (!messageReady())
- return;
-
- MessageIn msg = getNextMessage();
+ while (messageReady())
+ {
+ MessageIn msg = getNextMessage();
- std::map<Uint16, MessageHandler*>::iterator iter;
- iter = mMessageHandlers.find(msg.getId());
+ std::map<Uint16, MessageHandler*>::iterator iter;
+ iter = mMessageHandlers.find(msg.getId());
- if (iter != mMessageHandlers.end())
- iter->second->handleMessage(&msg);
- else
- logger->log("Unhandled packet: %x", msg.getId());
+ if (iter != mMessageHandlers.end())
+ iter->second->handleMessage(&msg);
+ else
+ logger->log("Unhandled packet: %x", msg.getId());
- skip(msg.getLength());
+ skip(msg.getLength());
+ }
}
void Network::flush()