From cee8174d02e38542548fc74de93450cfebefaa91 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Wed, 28 Apr 2021 14:36:14 +0200 Subject: Codechange: track servers with a ServerAddress instead of a NetworkAddress This allows future extensions to have different ways of referencing a server, instead of forcing to use IP:port. --- src/network/core/tcp.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/network/core/tcp.h') diff --git a/src/network/core/tcp.h b/src/network/core/tcp.h index 3b217cb2e..379ef8b92 100644 --- a/src/network/core/tcp.h +++ b/src/network/core/tcp.h @@ -103,9 +103,14 @@ private: void Connect(addrinfo *address); bool CheckActivity(); + /* We do not want any other derived classes from this class being able to + * access these private members, but it is okay for TCPServerConnecter. */ + friend class TCPServerConnecter; + static void ResolveThunk(TCPConnecter *connecter); public: + TCPConnecter() {}; TCPConnecter(const std::string &connection_string, uint16 default_port); virtual ~TCPConnecter(); @@ -124,4 +129,11 @@ public: static void KillAll(); }; +class TCPServerConnecter : public TCPConnecter { +public: + ServerAddress server_address; ///< Address we are connecting to. + + TCPServerConnecter(const std::string &connection_string, uint16 default_port); +}; + #endif /* NETWORK_CORE_TCP_H */ -- cgit v1.2.3-54-g00ecf