Fixed server termination issue.
This commit is contained in:
@@ -93,7 +93,8 @@ main(int argc, char *argv[])
|
||||
myServerGuiInterface->getSession().startNetworkServer();
|
||||
while (!g_pokerthTerminate)
|
||||
{
|
||||
myServerGuiInterface->getSession().waitForNetworkServer(100);
|
||||
if (myServerGuiInterface->getSession().waitForNetworkServer(100))
|
||||
g_pokerthTerminate = true;
|
||||
}
|
||||
myServerGuiInterface->getSession().terminateNetworkServer();
|
||||
|
||||
|
||||
+11
-5
@@ -235,15 +235,21 @@ void Session::terminateNetworkServer()
|
||||
myNetServer = 0;
|
||||
}
|
||||
|
||||
void Session::waitForNetworkServer(unsigned timeoutMsec)
|
||||
bool Session::waitForNetworkServer(unsigned timeoutMsec)
|
||||
{
|
||||
bool retVal = false;
|
||||
if (!myNetServer)
|
||||
return; // already terminated
|
||||
if (myNetServer->Join(timeoutMsec))
|
||||
retVal = true; // already terminated
|
||||
else
|
||||
{
|
||||
delete myNetServer;
|
||||
myNetServer = 0;
|
||||
if (myNetServer->Join(timeoutMsec))
|
||||
{
|
||||
delete myNetServer;
|
||||
myNetServer = 0;
|
||||
retVal = true;
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
void Session::startIrcClient()
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ public:
|
||||
void sendLeaveCurrentGame();
|
||||
void sendStartEvent(bool fillUpWithCpuPlayers);
|
||||
void terminateNetworkServer();
|
||||
void waitForNetworkServer(unsigned timeoutMsec);
|
||||
bool waitForNetworkServer(unsigned timeoutMsec);
|
||||
|
||||
void startIrcClient();
|
||||
void sendIrcChatMessage(const std::string &message);
|
||||
|
||||
Reference in New Issue
Block a user