Changeset - r11290:c014d31c30e7
[Not reviewed]
master
0 1 0
rubidium - 16 years ago 2009-03-08 16:14:14
rubidium@openttd.org
(svn r15644) -Fix [FS#2710]: closing a network connection twice in the case that sending packets starts failing while disconnecting
1 file changed with 8 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/network/network.cpp
Show inline comments
 
@@ -422,7 +422,14 @@ static NetworkClientSocket *NetworkAlloc
 
// Close a connection
 
void NetworkCloseClient(NetworkClientSocket *cs)
 
{
 
	assert(cs->sock != INVALID_SOCKET);
 
	/*
 
	 * Sending a message just before leaving the game calls cs->Send_Packets.
 
	 * This might invoke this function, which means that when we close the
 
	 * connection after cs->Send_Packets we will close an already closed
 
	 * connection. This handles that case gracefully without having to make
 
	 * that code any more complex or more aware of the validity of the socket.
 
	 */
 
	if (cs->sock == INVALID_SOCKET) return;
 

	
 
	DEBUG(net, 1, "Closed client connection %d", cs->client_id);
 

	
0 comments (0 inline, 0 general)