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/core/tcp.h | |
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/core/tcp.h')
-rw-r--r-- | src/network/core/tcp.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/network/core/tcp.h b/src/network/core/tcp.h index 44316bfca..3b217cb2e 100644 --- a/src/network/core/tcp.h +++ b/src/network/core/tcp.h @@ -33,6 +33,8 @@ class NetworkTCPSocketHandler : public NetworkSocketHandler { private: Packet *packet_queue; ///< Packets that are awaiting delivery Packet *packet_recv; ///< Partially received packet + + void EmptyPacketQueue(); public: SOCKET sock; ///< The socket currently connected to bool writable; ///< Can we write to this socket? @@ -43,7 +45,9 @@ public: */ bool IsConnected() const { return this->sock != INVALID_SOCKET; } - NetworkRecvStatus CloseConnection(bool error = true) override; + virtual NetworkRecvStatus CloseConnection(bool error = true); + void CloseSocket(); + virtual void SendPacket(Packet *packet); SendPacketsState SendPackets(bool closing_down = false); |