lowered numbers for sleeping when game is loading in network mode and allow ini override of values

This commit is contained in:
Mark Vejvoda 2011-11-15 16:41:10 +00:00
parent e8279621b1
commit 33e1af022a
2 changed files with 9 additions and 4 deletions

View File

@ -696,7 +696,9 @@ void ClientInterface::waitUntilReady(Checksum* checksum) {
int64 lastMillisCheck = 0;
uint64 waitLoopIterationCount = 0;
const uint64 MAX_LOOP_COUNT_BEFORE_SLEEP = 300;
uint64 MAX_LOOP_COUNT_BEFORE_SLEEP = 100;
MAX_LOOP_COUNT_BEFORE_SLEEP = Config::getInstance().getInt("NetworkClientLoopGameLoadingCap",intToStr(MAX_LOOP_COUNT_BEFORE_SLEEP).c_str());
uint sleepMillis = Config::getInstance().getInt("NetworkClientLoopGameLoadingCapSleepMillis","1");
//wait until we get a ready message from the server
while(true) {
@ -705,7 +707,7 @@ void ClientInterface::waitUntilReady(Checksum* checksum) {
waitLoopIterationCount++;
if(waitLoopIterationCount > 0 && waitLoopIterationCount % MAX_LOOP_COUNT_BEFORE_SLEEP == 0) {
sleep(1);
sleep(sleepMillis);
waitLoopIterationCount = 0;
}

View File

@ -1176,11 +1176,14 @@ void ServerInterface::waitUntilReady(Checksum *checksum) {
Lang &lang= Lang::getInstance();
uint64 waitLoopIterationCount = 0;
const uint64 MAX_LOOP_COUNT_BEFORE_SLEEP = 300;
uint64 MAX_LOOP_COUNT_BEFORE_SLEEP = 100;
MAX_LOOP_COUNT_BEFORE_SLEEP = Config::getInstance().getInt("NetworkServerLoopGameLoadingCap",intToStr(MAX_LOOP_COUNT_BEFORE_SLEEP).c_str());
uint sleepMillis = Config::getInstance().getInt("NetworkServerLoopGameLoadingCapSleepMillis","1");
while(exitServer == false && allReady == false && logger.getCancelLoading() == false) {
waitLoopIterationCount++;
if(waitLoopIterationCount > 0 && waitLoopIterationCount % MAX_LOOP_COUNT_BEFORE_SLEEP == 0) {
sleep(1);
sleep(sleepMillis);
waitLoopIterationCount = 0;
}
vector<string> waitingForHosts;