From c36e8297fab274eaaf5d360f5d16a9e9dccc2697 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Sat, 23 Mar 2013 22:56:08 +0000 Subject: [PATCH] - try to improve network performance --- source/glest_game/global/config.cpp | 4 +--- source/glest_game/network/client_interface.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/source/glest_game/global/config.cpp b/source/glest_game/global/config.cpp index f1bce539..c8233d02 100644 --- a/source/glest_game/global/config.cpp +++ b/source/glest_game/global/config.cpp @@ -28,9 +28,7 @@ using namespace std; namespace Glest{ namespace Game{ -// 20 was working ok, we try 10 to see if its better for performance -//int GameConstants::networkFramePeriod = 20; -int GameConstants::networkFramePeriod = 10; +int GameConstants::networkFramePeriod = 20; int GameConstants::updateFps = 40; int GameConstants::cameraFps = 100; diff --git a/source/glest_game/network/client_interface.cpp b/source/glest_game/network/client_interface.cpp index 6ce5d050..d28a23ea 100644 --- a/source/glest_game/network/client_interface.cpp +++ b/source/glest_game/network/client_interface.cpp @@ -79,9 +79,9 @@ void ClientInterfaceThread::execute() { Chrono chrono; // Set socket to blocking - if(clientInterface != NULL && clientInterface->getSocket(true) != NULL) { - clientInterface->getSocket(true)->setBlock(true); - } + //if(clientInterface != NULL && clientInterface->getSocket(true) != NULL) { + // clientInterface->getSocket(true)->setBlock(true); + //} for(;this->clientInterface != NULL;) { if(getQuitStatus() == true) { @@ -1782,8 +1782,8 @@ NetworkMessageType ClientInterface::waitForMessage(int waitMicroseconds) return msg; } // Sleep every x milli-seconds we wait to let other threads work - else if(chrono.getMillis() % 50 == 0) { - sleep(5); + else if(chrono.getMillis() % 100 == 0) { + sleep(10); } //sleep(waitSleepTime);