summaryrefslogtreecommitdiff
path: root/src/network/core/tcp.h
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-05-08 11:57:41 +0200
committerGitHub <noreply@github.com>2021-05-08 11:57:41 +0200
commitf187708b3b6bcb95a0d92908f8a90c1431ca2578 (patch)
treee9d4606dd161d1d2046dddc1c1cef748e283e6e0 /src/network/core/tcp.h
parent8c3fa2a3bf079424529a49b58f0466e4285d5874 (diff)
downloadopenttd-f187708b3b6bcb95a0d92908f8a90c1431ca2578.tar.xz
Fix f7e390bd: getpeername() doesn't work on closed sockets (#9213)
Diffstat (limited to 'src/network/core/tcp.h')
-rw-r--r--src/network/core/tcp.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/network/core/tcp.h b/src/network/core/tcp.h
index b90ce0232..624555649 100644
--- a/src/network/core/tcp.h
+++ b/src/network/core/tcp.h
@@ -15,8 +15,9 @@
#include "address.h"
#include "packet.h"
-#include <chrono>
#include <atomic>
+#include <chrono>
+#include <map>
/** The states of sending the packets. */
enum SendPacketsState {
@@ -66,6 +67,7 @@ class TCPConnecter {
private:
addrinfo *ai = nullptr; ///< getaddrinfo() allocated linked-list of resolved addresses.
std::vector<addrinfo *> addresses; ///< Addresses we can connect to.
+ std::map<SOCKET, NetworkAddress> sock_to_address; ///< Mapping of a socket to the real address it is connecting to. USed for DEBUG statements.
size_t current_address = 0; ///< Current index in addresses we are trying.
std::vector<SOCKET> sockets; ///< Pending connect() attempts.