summaryrefslogtreecommitdiff
path: root/src/net/manaserv
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-02-05 22:20:07 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-02-05 22:26:28 +0100
commit51e14c9d7aab75fe60f68d4943759eef66eafe9a (patch)
treecc132a87539ad0e461ac29fddc4b985b83362e72 /src/net/manaserv
parente5bca038ff79497ec2fde520132c017e5105ce60 (diff)
downloadmana-51e14c9d7aab75fe60f68d4943759eef66eafe9a.tar.gz
mana-51e14c9d7aab75fe60f68d4943759eef66eafe9a.tar.bz2
mana-51e14c9d7aab75fe60f68d4943759eef66eafe9a.tar.xz
mana-51e14c9d7aab75fe60f68d4943759eef66eafe9a.zip
Fixed the low framerate problem by not waiting for network events
The enet service loop was waiting up to 10ms for a new network packet to come in. There is no need for this, so just remove it. Raised the framerate from about 60 to over 200 fps for me.
Diffstat (limited to 'src/net/manaserv')
-rw-r--r--src/net/manaserv/network.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/net/manaserv/network.cpp b/src/net/manaserv/network.cpp
index 5bf411cb..ddadc007 100644
--- a/src/net/manaserv/network.cpp
+++ b/src/net/manaserv/network.cpp
@@ -142,8 +142,8 @@ void flush()
{
ENetEvent event;
- // Wait up to 10 milliseconds for an event.
- while (enet_host_service(client, &event, 10) > 0)
+ // Check if there are any new events
+ while (enet_host_service(client, &event, 0) > 0)
{
switch (event.type)
{
@@ -164,11 +164,7 @@ void flush()
break;
case ENET_EVENT_TYPE_NONE:
- logger->log("No event during 10 milliseconds.");
- break;
-
default:
- logger->log("Unhandled enet event.");
break;
}
}