Fix: [Network] clients leaving because of broken connections was not broadcasted (#9238)

The code mixed up "client has quit but we already told everyone"
with "client lost connection, handle this".

Split up those two signals:
- CLIENT_QUIT means we told everyone and the connection is now dead
- CONNECTION_LIST means we should tell everyone we lost a client
This commit is contained in:
Patric Stout
2021-05-11 12:26:16 +02:00
committed by GitHub
parent 2e429ee485
commit 36e22f3a7b
6 changed files with 25 additions and 24 deletions

View File

@@ -20,16 +20,17 @@ void NetworkCoreShutdown();
/** Status of a network client; reasons why a client has quit */
enum NetworkRecvStatus {
NETWORK_RECV_STATUS_OKAY, ///< Everything is okay
NETWORK_RECV_STATUS_DESYNC, ///< A desync did occur
NETWORK_RECV_STATUS_NEWGRF_MISMATCH, ///< We did not have the required NewGRFs
NETWORK_RECV_STATUS_SAVEGAME, ///< Something went wrong (down)loading the savegame
NETWORK_RECV_STATUS_CONN_LOST, ///< The connection is 'just' lost
NETWORK_RECV_STATUS_MALFORMED_PACKET, ///< We apparently send a malformed packet
NETWORK_RECV_STATUS_SERVER_ERROR, ///< The server told us we made an error
NETWORK_RECV_STATUS_SERVER_FULL, ///< The server is full
NETWORK_RECV_STATUS_SERVER_BANNED, ///< The server has banned us
NETWORK_RECV_STATUS_CLOSE_QUERY, ///< Done querying the server
NETWORK_RECV_STATUS_OKAY, ///< Everything is okay.
NETWORK_RECV_STATUS_DESYNC, ///< A desync did occur.
NETWORK_RECV_STATUS_NEWGRF_MISMATCH, ///< We did not have the required NewGRFs.
NETWORK_RECV_STATUS_SAVEGAME, ///< Something went wrong (down)loading the savegame.
NETWORK_RECV_STATUS_CLIENT_QUIT, ///< The connection is lost gracefully. Other clients are already informed of this leaving client.
NETWORK_RECV_STATUS_MALFORMED_PACKET, ///< We apparently send a malformed packet.
NETWORK_RECV_STATUS_SERVER_ERROR, ///< The server told us we made an error.
NETWORK_RECV_STATUS_SERVER_FULL, ///< The server is full.
NETWORK_RECV_STATUS_SERVER_BANNED, ///< The server has banned us.
NETWORK_RECV_STATUS_CLOSE_QUERY, ///< Done querying the server.
NETWORK_RECV_STATUS_CONNECTION_LOST, ///< The connection is lost unexpectedly.
};
/** Forward declaration due to circular dependencies */