Networking reliability changes

This commit is contained in:
mathusummut
2018-12-10 17:46:52 +01:00
parent 19fe3e6b52
commit 8ad84534ef
6 changed files with 12 additions and 21 deletions

View File

@@ -1,15 +1,8 @@
# Installing ZetaGlest # Installing ZetaGlest
It's recommended to first [read about the system
requirements](https://zetaglest.github.io/docs/system_requirements.html).
(even though they probably need editing and updating)
You can install from source or download Installers or packages for your You can install from source or download Installers or packages for your
operating system. operating system.
There hasn't been a formal first release of ZetaGlest yet, but you may
try development snapshots.
## Binary Packages ## Binary Packages
**Note:** Installation is not necessary to run the game. You can build **Note:** Installation is not necessary to run the game. You can build
@@ -73,7 +66,6 @@ INSTALL_DIR_MAN:PATH=/home/andy/local/share/man/man6
If you wish to install to a location that does not require super-user If you wish to install to a location that does not require super-user
privileges, change '/usr' to a location to which you have write access. privileges, change '/usr' to a location to which you have write access.
<!-- This needs to be duplicated in the BUILD.md and INSTALL.md doc -->
See [running](https://github.com/ZetaGlest/zetaglest-source#running) for See [running](https://github.com/ZetaGlest/zetaglest-source#running) for
detailed information about running a server or hosting a game. detailed information about running a server or hosting a game.
@@ -93,7 +85,6 @@ If you want to completely erase your previously-used options, remove
If your build doesn't seem to be using the options you gave it, first If your build doesn't seem to be using the options you gave it, first
try removing CMakeCache.txt and rebuilding. try removing CMakeCache.txt and rebuilding.
<!-- end duplication -->
**Note:** The majority of the game data is not installed during the **Note:** The majority of the game data is not installed during the
steps above. The files from the zetaglest-data repo must be copied into steps above. The files from the zetaglest-data repo must be copied into

View File

@@ -457,6 +457,7 @@ namespace Game {
luaScript.registerFunction(getUnitFaction, "unitFaction"); luaScript.registerFunction(getUnitFaction, "unitFaction");
luaScript.registerFunction(getFactionName, "getFactionName"); luaScript.registerFunction(getFactionName, "getFactionName");
luaScript.registerFunction(getUnitName, "unitName"); luaScript.registerFunction(getUnitName, "unitName");
luaScript.registerFunction(getResourceAmount, "resourceAmount"); luaScript.registerFunction(getResourceAmount, "resourceAmount");
luaScript.registerFunction(getLastCreatedUnitName, luaScript.registerFunction(getLastCreatedUnitName,

View File

@@ -48,7 +48,6 @@ using namespace Shared;
using namespace Shared::Util; using namespace Shared::Util;
namespace Game { namespace Game {
const int MASTERSERVER_BROADCAST_MAX_WAIT_RESPONSE_SECONDS = 15;
static const char *SAVED_GAME_FILENAME = "lastCustomGameSettings.zgg"; static const char *SAVED_GAME_FILENAME = "lastCustomGameSettings.zgg";
static const char *DEFAULT_GAME_FILENAME = "data/defaultGameSetup.zgg"; static const char *DEFAULT_GAME_FILENAME = "data/defaultGameSetup.zgg";
static const char *DEFAULT_NETWORKGAME_FILENAME = static const char *DEFAULT_NETWORKGAME_FILENAME =
@@ -3828,32 +3827,30 @@ namespace Game {
return; return;
} }
// Give things another chance to see if we can get a connection from the master server /*if (tMasterserverErrorElapsed > 0 &&
if (tMasterserverErrorElapsed > 0 &&
difftime((long int) time(NULL), difftime((long int) time(NULL),
tMasterserverErrorElapsed) > tMasterserverErrorElapsed) >
MASTERSERVER_BROADCAST_MAX_WAIT_RESPONSE_SECONDS) { MASTERSERVER_BROADCAST_MAX_WAIT_RESPONSE_SECONDS) {
showMasterserverError = true; showMasterserverError = true;
masterServererErrorToShow = masterServererErrorToShow =
(serverInfo != "" ? serverInfo : "No Reply"); (serverInfo != "" ? serverInfo : "No Reply");
} else { } else {*/
if (tMasterserverErrorElapsed == 0) { if (tMasterserverErrorElapsed == 0) {
tMasterserverErrorElapsed = time(NULL); tMasterserverErrorElapsed = time(NULL);
} }
SystemFlags::OutputDebug(SystemFlags::debugError, SystemFlags::OutputDebug(SystemFlags::debugError,
"In [%s::%s Line %d] error checking response from masterserver elapsed seconds = %.2f / %d\nResponse:\n%s\n", "In [%s::%s Line %d] error checking response from masterserver elapsed seconds = %.2f\nResponse:\n%s\n",
extractFileFromDirectoryPath extractFileFromDirectoryPath
(__FILE__).c_str(), (__FILE__).c_str(),
__FUNCTION__, __LINE__, __FUNCTION__, __LINE__,
difftime((long int) difftime((long int)
time(NULL), time(NULL),
tMasterserverErrorElapsed), tMasterserverErrorElapsed),
MASTERSERVER_BROADCAST_MAX_WAIT_RESPONSE_SECONDS,
serverInfo.c_str()); serverInfo.c_str());
// Give things another chance to see if we can get a connection from the master server
needToRepublishToMasterserver = true; needToRepublishToMasterserver = true;
} //}
} }
} else { } else {
safeMutexThreadOwner.ReleaseLock(); safeMutexThreadOwner.ReleaseLock();

View File

@@ -1481,7 +1481,7 @@ namespace Game {
} }
bool ClientInterface::isMasterServerAdminOverride() { bool ClientInterface::isMasterServerAdminOverride() {
return (gameSettings.getMasterserver_admin() == this->getSessionKey()); return gameSettings.getMasterserver_admin() == this->getSessionKey();
} }
void ClientInterface::waitUntilReady(Checksum* checksum) { void ClientInterface::waitUntilReady(Checksum* checksum) {

View File

@@ -852,7 +852,7 @@ namespace Game {
//printf("Got uuid from client [%s]\n",this->playerUUID.c_str()); //printf("Got uuid from client [%s]\n",this->playerUUID.c_str());
if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s] got name [%s] versionString [%s], msgSessionId = %d\n", __FILE__, __FUNCTION__, name.c_str(), versionString.c_str(), msgSessionId); if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s] got name [%s] versionString [%s], msgSessionId = %d\n", __FILE__, __FUNCTION__, name.c_str(), versionString.c_str(), msgSessionId);
if (msgSessionId != sessionKey) { /*if (msgSessionId != sessionKey) {
string playerNameStr = name; string playerNameStr = name;
string sErr = "Client gave invalid sessionid for player [" + playerNameStr + "] actual [" + intToStr(msgSessionId) + "] expected [" + intToStr(sessionKey) + "]"; string sErr = "Client gave invalid sessionid for player [" + playerNameStr + "] actual [" + intToStr(msgSessionId) + "] expected [" + intToStr(sessionKey) + "]";
printf("%s\n", sErr.c_str()); printf("%s\n", sErr.c_str());
@@ -860,7 +860,7 @@ namespace Game {
close(); close();
return; return;
} else if (this->playerUUID == "") { } else */if (this->playerUUID == "") {
string playerNameStr = name; string playerNameStr = name;
string sErr = "Client gave an invalid UUID for player [" + playerNameStr + "]"; string sErr = "Client gave an invalid UUID for player [" + playerNameStr + "]";
printf("%s\n", sErr.c_str()); printf("%s\n", sErr.c_str());
@@ -970,7 +970,7 @@ namespace Game {
throw game_runtime_error(szBuf); throw game_runtime_error(szBuf);
} }
int minHeadLessPlayersRequired = Config::getInstance().getInt("MinHeadlessPlayersRequired", "2"); int minHeadLessPlayersRequired = Config::getInstance().getInt("MinHeadlessPlayersRequired", "1");
if (this->joinGameInProgress == false && if (this->joinGameInProgress == false &&
networkMessageLaunch.getMessageType() == nmtLaunch && networkMessageLaunch.getMessageType() == nmtLaunch &&
this->ready == false && this->ready == false &&
@@ -1281,6 +1281,8 @@ namespace Game {
//printf("#2 Server slot got currentFrameCount = %d\n",currentFrameCount); //printf("#2 Server slot got currentFrameCount = %d\n",currentFrameCount);
this->currentLagCount = 0; this->currentLagCount = 0;
this->graceLagCtr = 0;
this->lastReceiveCommandListTime = time(NULL); this->lastReceiveCommandListTime = time(NULL);
this->setReady(); this->setReady();