- bugfixes to master server communication logic when starting a game. Now we only send updates if the game was published, not for every network game. Also we properly delete the game from the masterserver when it has ended.
This commit is contained in:
parent
6a0e876bf2
commit
c3d41f5082
|
@ -956,6 +956,11 @@ void MenuStateCustomGame::PlayNow() {
|
|||
lastSetChangedGameSettings = time(NULL);
|
||||
}
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
// Tell the server Interface whether or not to publish game status updates to masterserver
|
||||
serverInterface->setNeedToRepublishToMasterserver(listBoxPublishServer.getSelectedItemIndex() == 0);
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
bool bOkToStart = serverInterface->launchGame(&gameSettings);
|
||||
if(bOkToStart == true) {
|
||||
|
|
|
@ -66,6 +66,7 @@ ServerInterface::ServerInterface() {
|
|||
gameStartTime = 0;
|
||||
publishToMasterserverThread = NULL;
|
||||
lastMasterserverHeartbeatTime = 0;
|
||||
needToRepublishToMasterserver = false;
|
||||
|
||||
enabledThreadedClientCommandBroadcast = Config::getInstance().getBool("EnableThreadedClientCommandBroadcast","false");
|
||||
maxFrameCountLagAllowed = Config::getInstance().getInt("MaxFrameCountLagAllowed",intToStr(maxFrameCountLagAllowed).c_str());
|
||||
|
@ -103,7 +104,8 @@ ServerInterface::~ServerInterface() {
|
|||
delete publishToMasterserverThread;
|
||||
publishToMasterserverThread = NULL;
|
||||
safeMutex.ReleaseLock();
|
||||
// This triggers a gameOVer message to be sent to the masterserver
|
||||
// This triggers a gameOver message to be sent to the masterserver
|
||||
lastMasterserverHeartbeatTime = 0;
|
||||
simpleTask();
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
@ -1076,6 +1078,7 @@ bool ServerInterface::launchGame(const GameSettings* gameSettings) {
|
|||
delete publishToMasterserverThread;
|
||||
publishToMasterserverThread = NULL;
|
||||
|
||||
lastMasterserverHeartbeatTime = 0;
|
||||
publishToMasterserverThread = new SimpleTaskThread(this,0,25);
|
||||
publishToMasterserverThread->setUniqueID(__FILE__);
|
||||
publishToMasterserverThread->start();
|
||||
|
@ -1453,8 +1456,7 @@ void ServerInterface::simpleTask() {
|
|||
|
||||
lastMasterserverHeartbeatTime = time(NULL);
|
||||
|
||||
bool isNetworkGame = (this->getGameSettings() != NULL && this->getGameSettings()->isNetworkGame());
|
||||
if(isNetworkGame == true) {
|
||||
if(needToRepublishToMasterserver == true) {
|
||||
//string request = Config::getInstance().getString("Masterserver") + "addServerInfo.php?" + newPublishToServerInfo;
|
||||
string request = Config::getInstance().getString("Masterserver") + "addServerInfo.php?";
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ private:
|
|||
SimpleTaskThread *publishToMasterserverThread;
|
||||
Mutex masterServerThreadAccessor;
|
||||
time_t lastMasterserverHeartbeatTime;
|
||||
bool needToRepublishToMasterserver;
|
||||
|
||||
public:
|
||||
ServerInterface();
|
||||
|
@ -103,6 +104,9 @@ public:
|
|||
virtual string getHumanPlayerName(int index=-1);
|
||||
virtual int getHumanPlayerIndex() const;
|
||||
|
||||
bool getNeedToRepublishToMasterserver() const {return needToRepublishToMasterserver;}
|
||||
void setNeedToRepublishToMasterserver(bool value) {needToRepublishToMasterserver = value;}
|
||||
|
||||
public:
|
||||
|
||||
Mutex * getServerSynchAccessor() { return &serverSynchAccessor; }
|
||||
|
|
Loading…
Reference in New Issue
Block a user