summaryrefslogtreecommitdiff
path: root/src/network/core/tcp_connect.cpp
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-05-12 16:34:02 +0200
committerGitHub <noreply@github.com>2021-05-12 16:34:02 +0200
commitb136e65cf9375700e77579b344f8dd86a5a61336 (patch)
tree829083df6b7c2f86a2e70eba91bc5e88230a8586 /src/network/core/tcp_connect.cpp
parent56050fc96f59cef171d3b8a03ae3f3c9b83f9426 (diff)
downloadopenttd-b136e65cf9375700e77579b344f8dd86a5a61336.tar.xz
Change: reworked the debug levels for network facility (#9251)
It now follows very simple rules: 0 - Fatal, user should know about this 1 - Error, but we are recovering 2 - Warning, wrong but okay if you don't know 3 - Info, information you might care about 4 - 5 - Debug #1 - High level debug messages 6 - Debug #2 - Low level debug messages 7 - Trace information
Diffstat (limited to 'src/network/core/tcp_connect.cpp')
-rw-r--r--src/network/core/tcp_connect.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/network/core/tcp_connect.cpp b/src/network/core/tcp_connect.cpp
index b343ae463..381f7e589 100644
--- a/src/network/core/tcp_connect.cpp
+++ b/src/network/core/tcp_connect.cpp
@@ -72,7 +72,7 @@ void TCPConnecter::Connect(addrinfo *address)
}
NetworkAddress network_address = NetworkAddress(address->ai_addr, (int)address->ai_addrlen);
- DEBUG(net, 4, "Attempting to connect to %s", network_address.GetAddressAsString().c_str());
+ DEBUG(net, 5, "Attempting to connect to %s", network_address.GetAddressAsString().c_str());
int err = connect(sock, address->ai_addr, (int)address->ai_addrlen);
if (err != 0 && !NetworkError::GetLast().IsConnectInProgress()) {
@@ -149,10 +149,10 @@ void TCPConnecter::OnResolved(addrinfo *ai)
}
}
- if (_debug_net_level >= 5) {
- DEBUG(net, 5, "%s resolved in:", this->connection_string.c_str());
+ if (_debug_net_level >= 6) {
+ DEBUG(net, 6, "%s resolved in:", this->connection_string.c_str());
for (const auto &address : this->addresses) {
- DEBUG(net, 5, "- %s", NetworkAddress(address->ai_addr, (int)address->ai_addrlen).GetAddressAsString().c_str());
+ DEBUG(net, 6, "- %s", NetworkAddress(address->ai_addr, (int)address->ai_addrlen).GetAddressAsString().c_str());
}
}
@@ -188,7 +188,7 @@ void TCPConnecter::Resolve()
}
if (e != 0) {
- DEBUG(misc, 0, "Failed to resolve DNS for %s", this->connection_string.c_str());
+ DEBUG(net, 0, "Failed to resolve DNS for %s", this->connection_string.c_str());
this->OnFailure();
return;
}
@@ -235,7 +235,7 @@ bool TCPConnecter::CheckActivity()
/* select() failed; hopefully next try it doesn't. */
if (n < 0) {
/* select() normally never fails; so hopefully it works next try! */
- DEBUG(net, 1, "select() failed with %s", NetworkError::GetLast().AsString());
+ DEBUG(net, 1, "select() failed: %s", NetworkError::GetLast().AsString());
return false;
}
@@ -301,7 +301,7 @@ bool TCPConnecter::CheckActivity()
}
assert(connected_socket != INVALID_SOCKET);
- DEBUG(net, 1, "Connected to %s", this->connection_string.c_str());
+ DEBUG(net, 3, "Connected to %s", this->connection_string.c_str());
if (_debug_net_level >= 5) {
DEBUG(net, 5, "- using %s", NetworkAddress::GetPeerName(connected_socket).c_str());
}