Changeset - r28575:8bbb27103bfb
[Not reviewed]
master
0 1 0
Patric Stout - 10 months ago 2024-01-27 10:23:25
truebrain@openttd.org
Fix: update server as offline when unexpected disconnect during refresh (#11891)
1 file changed with 10 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/network/network_query.cpp
Show inline comments
 
@@ -24,6 +24,15 @@ NetworkRecvStatus QueryNetworkGameSocket
 
	assert(status != NETWORK_RECV_STATUS_OKAY);
 
	assert(this->sock != INVALID_SOCKET);
 

	
 
	/* Connection is closed, but we never received a packet. Must be offline. */
 
	NetworkGameList *item = NetworkGameListAddItem(this->connection_string);
 
	if (item->refreshing) {
 
		item->status = NGLS_OFFLINE;
 
		item->refreshing = false;
 

	
 
		UpdateNetworkGameWindow();
 
	}
 

	
 
	return status;
 
}
 

	
 
@@ -36,6 +45,7 @@ bool QueryNetworkGameSocketHandler::Chec
 

	
 
	/* If there was no response in 5 seconds, terminate the query. */
 
	if (lag > std::chrono::seconds(5)) {
 
		Debug(net, 0, "Timeout while waiting for response from {}", this->connection_string);
 
		this->CloseConnection(NETWORK_RECV_STATUS_CONNECTION_LOST);
 
		return false;
 
	}
0 comments (0 inline, 0 general)