summaryrefslogtreecommitdiff
path: root/src/net/connection.cpp
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-01-05 20:12:51 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-01-05 20:12:51 +0000
commit593e65eef0d43f2ff61dc1b4f3160c0a16b5f015 (patch)
tree8e0a1ca0c73778f0e4d71f4da4d5c47f272915b9 /src/net/connection.cpp
parentf96ca90ba90da3175be96ff7ed34efb78ea5dfed (diff)
downloadmanaserv-593e65eef0d43f2ff61dc1b4f3160c0a16b5f015.tar.gz
manaserv-593e65eef0d43f2ff61dc1b4f3160c0a16b5f015.tar.bz2
manaserv-593e65eef0d43f2ff61dc1b4f3160c0a16b5f015.tar.xz
manaserv-593e65eef0d43f2ff61dc1b4f3160c0a16b5f015.zip
Simplified handling of verbosity levels. Optimized code by generating only needed messages.
Diffstat (limited to 'src/net/connection.cpp')
-rw-r--r--src/net/connection.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/net/connection.cpp b/src/net/connection.cpp
index 8a5c8d0e..faff533c 100644
--- a/src/net/connection.cpp
+++ b/src/net/connection.cpp
@@ -79,7 +79,7 @@ void Connection::send(MessageOut const &msg, bool reliable, unsigned channel)
}
else
{
- LOG_WARN("Failure to create packet!", 0);
+ LOG_ERROR("Failure to create packet!");
}
}
@@ -92,12 +92,15 @@ void Connection::process()
switch (event.type)
{
case ENET_EVENT_TYPE_RECEIVE:
- if (event.packet->dataLength >= 2) {
+ if (event.packet->dataLength >= 2)
+ {
MessageIn msg((char *)event.packet->data,
event.packet->dataLength);
processMessage(msg);
- } else {
- LOG_ERROR("Message too short.", 0);
+ }
+ else
+ {
+ LOG_WARN("Message too short.");
}
// Clean up the packet now that we are done using it.
enet_packet_destroy(event.packet);