diff options
author | Patric Stout <truebrain@openttd.org> | 2021-05-13 11:46:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-13 11:46:51 +0200 |
commit | a403653805c6fd6022868c5f381e10107e1d2b20 (patch) | |
tree | b44e4df40d65cf1fecdadab090badb73d78e0a6d /src/network/network_client.cpp | |
parent | 86741ad489c3ee2d519eeb071be846721b90412c (diff) | |
download | openttd-a403653805c6fd6022868c5f381e10107e1d2b20.tar.xz |
Codechange: [Network] split CloseSocket and CloseConnection more clearly (#9261)
* Codechange: [Network] split CloseSocket and CloseConnection more clearly
- CloseSocket now closes the actual OS socket.
- CloseConnection frees up the resources to just before CloseSocket.
- dtors call CloseSocket / CloseConnection where needed.
Diffstat (limited to 'src/network/network_client.cpp')
-rw-r--r-- | src/network/network_client.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp index 34746e935..7852a6da9 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -158,6 +158,7 @@ ClientNetworkGameSocketHandler::~ClientNetworkGameSocketHandler() ClientNetworkGameSocketHandler::my_client = nullptr; delete this->savegame; + delete this->GetInfo(); } NetworkRecvStatus ClientNetworkGameSocketHandler::CloseConnection(NetworkRecvStatus status) @@ -182,7 +183,6 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::CloseConnection(NetworkRecvSta * which would trigger the server to close the connection as well. */ CSleep(3 * MILLISECONDS_PER_TICK); - delete this->GetInfo(); delete this; return status; @@ -200,7 +200,7 @@ void ClientNetworkGameSocketHandler::ClientError(NetworkRecvStatus res) /* We just want to close the connection.. */ if (res == NETWORK_RECV_STATUS_CLOSE_QUERY) { - this->NetworkSocketHandler::CloseConnection(); + this->NetworkSocketHandler::MarkClosed(); this->CloseConnection(res); _networking = false; |