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