summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-05-08 10:53:21 +0200
committerPatric Stout <github@truebrain.nl>2021-05-08 17:26:10 +0200
commit664a8c3e85cef684610e0fa65fb2ea587e46232f (patch)
tree59632c3427c43c46aa58d783d06565daf404fd43 /src/network
parentde940b1dbc7a1d6f245f3965bc43e8885b690441 (diff)
downloadopenttd-664a8c3e85cef684610e0fa65fb2ea587e46232f.tar.xz
Codechange: move connection_string to private for TCPConnecter
The most common case never needs access to it anymore. Make the one exception to this explicit. This means the fact that we store it is now an implementation detail.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/core/tcp.h3
-rw-r--r--src/network/network.cpp5
2 files changed, 5 insertions, 3 deletions
diff --git a/src/network/core/tcp.h b/src/network/core/tcp.h
index 624555649..1eddec6a4 100644
--- a/src/network/core/tcp.h
+++ b/src/network/core/tcp.h
@@ -74,6 +74,7 @@ private:
std::chrono::steady_clock::time_point last_attempt; ///< Time we last tried to connect.
std::atomic<bool> is_resolved = false; ///< Whether resolving is done.
+ std::string connection_string; ///< Current address we are connecting to (before resolving).
void Resolve();
void OnResolved(addrinfo *ai);
@@ -84,8 +85,6 @@ private:
static void ResolveThunk(TCPConnecter *connecter);
public:
- std::string connection_string; ///< Current address we are connecting to (before resolving).
-
TCPConnecter(const std::string &connection_string, uint16 default_port);
virtual ~TCPConnecter();
diff --git a/src/network/network.cpp b/src/network/network.cpp
index 3965c200f..5d12aa732 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -1145,8 +1145,11 @@ static void NetworkGenerateServerId()
}
class TCPNetworkDebugConnecter : TCPConnecter {
+private:
+ std::string connection_string;
+
public:
- TCPNetworkDebugConnecter(const std::string &connection_string) : TCPConnecter(connection_string, NETWORK_DEFAULT_DEBUGLOG_PORT) {}
+ TCPNetworkDebugConnecter(const std::string &connection_string) : TCPConnecter(connection_string, NETWORK_DEFAULT_DEBUGLOG_PORT), connection_string(connection_string) {}
void OnFailure() override
{