Test fix for rejoining

This commit is contained in:
mathusummut 2018-09-22 11:10:11 +02:00
parent 3045e736ea
commit f33c8cd27b

View File

@ -1010,13 +1010,14 @@ namespace Glest {
//make sure we read the message //make sure we read the message
//time_t receiveTimeElapsed = time(NULL); //time_t receiveTimeElapsed = time(NULL);
/*NetworkMessageCommandList networkMessageCommandList; NetworkMessageCommandList networkMessageCommandList;
bool gotCmd = receiveMessage(&networkMessageCommandList); bool gotCmd = receiveMessage(&networkMessageCommandList);
if (gotCmd == false) { if (gotCmd == false) {
throw megaglest_runtime_error("error retrieving nmtCommandList returned false!"); printf("Server has interrupted network connection...\n");
return;
} }
if (SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance, "In [%s::%s Line: %d] took msecs: %lld\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, chrono.getMillis()); if (SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance, "In [%s::%s Line: %d] took msecs: %lld\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, chrono.getMillis());
if (SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) chrono.start();*/ if (SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) chrono.start();
this->setLastPingInfoToNow(); this->setLastPingInfoToNow();
} }
@ -1025,11 +1026,12 @@ namespace Glest {
case nmtQuit: case nmtQuit:
{ {
//time_t receiveTimeElapsed = time(NULL); //time_t receiveTimeElapsed = time(NULL);
/*NetworkMessageQuit networkMessageQuit; NetworkMessageQuit networkMessageQuit;
bool gotCmd = receiveMessage(&networkMessageQuit); bool gotCmd = receiveMessage(&networkMessageQuit);
if (gotCmd == false) { if (gotCmd == false) {
throw megaglest_runtime_error("error retrieving nmtQuit returned false!"); printf("Server has interrupted connection...\n");
}*/ return;
}
if (SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance, "In [%s::%s Line: %d] took msecs: %lld\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, chrono.getMillis()); if (SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance, "In [%s::%s Line: %d] took msecs: %lld\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, chrono.getMillis());
if (SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) chrono.start(); if (SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) chrono.start();
@ -1126,10 +1128,10 @@ namespace Glest {
if (isConnected() == false) { if (isConnected() == false) {
setQuit(true); setQuit(true);
close(); close();
return;
} }
//throw megaglest_runtime_error("error retrieving nmtCommandList returned false!"); //throw megaglest_runtime_error("error retrieving nmtCommandList returned false!");
printf("Network connection has been interrupted...\n");
return;
} }
//printf("Client Thread getFrameCount(): %d getCommandCount(): %d\n",networkMessageCommandList.getFrameCount(),networkMessageCommandList.getCommandCount()); //printf("Client Thread getFrameCount(): %d getCommandCount(): %d\n",networkMessageCommandList.getFrameCount(),networkMessageCommandList.getCommandCount());
@ -1606,11 +1608,12 @@ namespace Glest {
} }
} else if (networkMessageType == nmtCommandList) { } else if (networkMessageType == nmtCommandList) {
//make sure we read the message //make sure we read the message
/*NetworkMessageCommandList networkMessageCommandList; NetworkMessageCommandList networkMessageCommandList;
bool gotCmd = receiveMessage(&networkMessageCommandList); bool gotCmd = receiveMessage(&networkMessageCommandList);
if (gotCmd == false) { if (gotCmd == false) {
throw megaglest_runtime_error("error retrieving nmtCommandList returned false!"); printf("Server has interrupted network connection...\n");
}*/ return;
}
} else if (networkMessageType == nmtInvalid) { } else if (networkMessageType == nmtInvalid) {
if (chrono.getMillis() > readyWaitTimeout) { if (chrono.getMillis() > readyWaitTimeout) {
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__);