Skip to content

Commit f3cfbd6

Browse files
committed
net: log connections failures via SOCKS5 with less severity
It is expected to have some Bitcoin nodes unreachable some of the time. A failure to connect to an IPv4 or IPv6 node is already properly logged under category=net/severity=debug. Do the same when a connection fails when using a SOCKS5 proxy. This could be either to an .onion address or to an IPv4 or IPv6 address (via a Tor exit node). Related: bitcoin#29759
1 parent 43a66c5 commit f3cfbd6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/netbase.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,8 @@ bool Socks5(const std::string& strDest, uint16_t port, const ProxyCredentials* a
443443
}
444444
if (pchRet2[1] != SOCKS5Reply::SUCCEEDED) {
445445
// Failures to connect to a peer that are not proxy errors
446-
LogPrintf("Socks5() connect to %s:%d failed: %s\n", strDest, port, Socks5ErrorString(pchRet2[1]));
446+
LogPrintLevel(BCLog::NET, BCLog::Level::Debug,
447+
"Socks5() connect to %s:%d failed: %s\n", strDest, port, Socks5ErrorString(pchRet2[1]));
447448
return false;
448449
}
449450
if (pchRet2[2] != 0x00) { // Reserved field must be 0
@@ -569,7 +570,7 @@ static bool ConnectToSocket(const Sock& sock, struct sockaddr* sockaddr, socklen
569570
NetworkErrorString(WSAGetLastError()));
570571
return false;
571572
} else if (occurred == 0) {
572-
LogPrint(BCLog::NET, "connection attempt to %s timed out\n", dest_str);
573+
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "connection attempt to %s timed out\n", dest_str);
573574
return false;
574575
}
575576

0 commit comments

Comments
 (0)