Skip to content

Commit

Permalink
Clean up sockets. This should fix not being able to host immediately …
Browse files Browse the repository at this point in the history
…after you look for a game in the lobby.
  • Loading branch information
vexed committed Jan 27, 2012
1 parent 47c6650 commit 4ed75e9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/netplay/netplay.cpp
Expand Up @@ -2663,6 +2663,9 @@ bool NETfindGame(void)
{
debug(LOG_NET, "only %u game(s) received", (unsigned int)gamecount);
// If we fail, success depends on the amount of games that we've read already
SocketSet_DelSocket(socket_set, tcp_socket); // mark it invalid
socketClose(tcp_socket);
tcp_socket = NULL;
return gamecount;
}

Expand All @@ -2681,6 +2684,9 @@ bool NETfindGame(void)
addConsoleMessage(_("Failed to get a lobby response!"), DEFAULT_JUSTIFY, NOTIFY_MESSAGE);
return true; // while there was a problem, this isn't fatal for the function
}
SocketSet_DelSocket(socket_set, tcp_socket); // mark it invalid (we are done with it)
socketClose(tcp_socket);
tcp_socket = NULL;
addConsoleMessage(NetPlay.MOTD, DEFAULT_JUSTIFY, SYSTEM_MESSAGE);
return true;
}
Expand Down

0 comments on commit 4ed75e9

Please sign in to comment.