Merge bitcoin/bitcoin#30064: net: log connections failures via SOCKS5 with less severity

f3cfbd65f5 net: log connections failures via SOCKS5 with less severity (Vasil Dimov)

Pull request description:

  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: https://github.com/bitcoin/bitcoin/issues/29759

ACKs for top commit:
  achow101:
    ACK f3cfbd65f5
  mzumsande:
    Code Review ACK f3cfbd65f5
  tdb3:
    Code Review ACK f3cfbd65f5

Tree-SHA512: c6e83568783cb5233edac7840a00f708d27be9af87480fc73093ad99fe4bd8670d3f2c97fd6b6e2c54b8d9337746eacb9a5db6eefecc1486951996bfbb0a37f7
This commit is contained in:
Ava Chow 2024-08-05 17:44:12 -04:00
commit 44a4a0151c
No known key found for this signature in database
GPG key ID: 17565732E08E5E41

View file

@ -456,7 +456,8 @@ bool Socks5(const std::string& strDest, uint16_t port, const ProxyCredentials* a
}
if (pchRet2[1] != SOCKS5Reply::SUCCEEDED) {
// Failures to connect to a peer that are not proxy errors
LogPrintf("Socks5() connect to %s:%d failed: %s\n", strDest, port, Socks5ErrorString(pchRet2[1]));
LogPrintLevel(BCLog::NET, BCLog::Level::Debug,
"Socks5() connect to %s:%d failed: %s\n", strDest, port, Socks5ErrorString(pchRet2[1]));
return false;
}
if (pchRet2[2] != 0x00) { // Reserved field must be 0
@ -584,7 +585,7 @@ static bool ConnectToSocket(const Sock& sock, struct sockaddr* sockaddr, socklen
NetworkErrorString(WSAGetLastError()));
return false;
} else if (occurred == 0) {
LogPrint(BCLog::NET, "connection attempt to %s timed out\n", dest_str);
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "connection attempt to %s timed out\n", dest_str);
return false;
}