- try to improve network performance
This commit is contained in:
parent
b2853b760e
commit
079dbf808a
|
@ -304,7 +304,7 @@ void ClientInterface::connect(const Ip &ip, int port) {
|
||||||
clientSocket->setBlock(false);
|
clientSocket->setBlock(false);
|
||||||
clientSocket->connect(ip, port);
|
clientSocket->connect(ip, port);
|
||||||
connectedTime = time(NULL);
|
connectedTime = time(NULL);
|
||||||
clientSocket->setBlock(true);
|
//clientSocket->setBlock(true);
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] END - socket = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,clientSocket->getSocketId());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] END - socket = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,clientSocket->getSocketId());
|
||||||
}
|
}
|
||||||
|
@ -901,7 +901,7 @@ void ClientInterface::updateFrame(int *checkFrame) {
|
||||||
Chrono chrono;
|
Chrono chrono;
|
||||||
chrono.start();
|
chrono.start();
|
||||||
|
|
||||||
int waitMicroseconds = (checkFrame == NULL ? 0 : 0);
|
int waitMicroseconds = (checkFrame == NULL ? 10 : 0);
|
||||||
int simulateLag = Config::getInstance().getInt("SimulateClientLag","0");
|
int simulateLag = Config::getInstance().getInt("SimulateClientLag","0");
|
||||||
bool done= false;
|
bool done= false;
|
||||||
while(done == false && this->quitThread == false) {
|
while(done == false && this->quitThread == false) {
|
||||||
|
@ -1785,7 +1785,7 @@ NetworkMessageType ClientInterface::waitForMessage(int waitMicroseconds)
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
// Sleep every x milli-seconds we wait to let other threads work
|
// Sleep every x milli-seconds we wait to let other threads work
|
||||||
else if(chrono.getMillis() % 100 == 0) {
|
else if(chrono.getMillis() % 20 == 0) {
|
||||||
sleep(5);
|
sleep(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2157,17 +2157,17 @@ bool ServerInterface::launchGame(const GameSettings *gameSettings) {
|
||||||
if(bOkToStart == true) {
|
if(bOkToStart == true) {
|
||||||
|
|
||||||
bool useInGameBlockingClientSockets = Config::getInstance().getBool("EnableInGameBlockingSockets","true");
|
bool useInGameBlockingClientSockets = Config::getInstance().getBool("EnableInGameBlockingSockets","true");
|
||||||
// if(useInGameBlockingClientSockets == true) {
|
if(useInGameBlockingClientSockets == true) {
|
||||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
// for(int i= 0; i < GameConstants::maxPlayers; ++i) {
|
for(int i= 0; i < GameConstants::maxPlayers; ++i) {
|
||||||
// int factionIndex = gameSettings->getFactionIndexForStartLocation(i);
|
int factionIndex = gameSettings->getFactionIndexForStartLocation(i);
|
||||||
// MutexSafeWrapper safeMutexSlot(slotAccessorMutexes[i],CODE_AT_LINE_X(i));
|
MutexSafeWrapper safeMutexSlot(slotAccessorMutexes[i],CODE_AT_LINE_X(i));
|
||||||
// ConnectionSlot *connectionSlot= slots[i];
|
ConnectionSlot *connectionSlot= slots[i];
|
||||||
// if(connectionSlot != NULL && connectionSlot->isConnected()) {
|
if(connectionSlot != NULL && connectionSlot->isConnected()) {
|
||||||
// connectionSlot->getSocket()->setBlock(true);
|
connectionSlot->getSocket()->setBlock(true);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
bool requiresUPNPTrigger = false;
|
bool requiresUPNPTrigger = false;
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
@ -2273,9 +2273,9 @@ void ServerInterface::checkListenerSlots() {
|
||||||
|
|
||||||
addSlot(i);
|
addSlot(i);
|
||||||
connectionSlot = slots[i];
|
connectionSlot = slots[i];
|
||||||
// if(useInGameBlockingClientSockets == true) {
|
if(useInGameBlockingClientSockets == true) {
|
||||||
// connectionSlot->getSocket()->setBlock(true);
|
connectionSlot->getSocket()->setBlock(true);
|
||||||
// }
|
}
|
||||||
connectionSlot->setCanAcceptConnections(true);
|
connectionSlot->setCanAcceptConnections(true);
|
||||||
}
|
}
|
||||||
else if(connectionSlot != NULL &&
|
else if(connectionSlot != NULL &&
|
||||||
|
|
Loading…
Reference in New Issue
Block a user