aboutsummaryrefslogtreecommitdiff
path: root/src/netbase.cpp
diff options
context:
space:
mode:
authorWarren Togami <wtogami@gmail.com>2016-05-09 17:01:33 -0700
committerWarren Togami <wtogami@gmail.com>2016-05-09 18:13:55 -0700
commit00678bdb0aeb296456501f818faaa012a75ce18e (patch)
tree82f40ba77f5b4d1bf3fca4f709d84aac1fb51dbf /src/netbase.cpp
parent4e14afe42fdd468d5de11df8cc13defdcb8e83f8 (diff)
downloadbitcoin-00678bdb0aeb296456501f818faaa012a75ce18e.tar.xz
Make failures to connect via Socks5() more informative and less unnecessarily scary.
* The "ERROR" was printed far too often during normal operation for what was not an error. * Makes the Socks5() connect failure similar to the IP connect failure in debug.log. Before: `2016-05-09 00:15:00 ERROR: Proxy error: host unreachable` After: `2016-05-09 00:15:00 Socks5() connect to t6xj6wilh4ytvcs7.onion:18333 failed: host unreachable"`
Diffstat (limited to 'src/netbase.cpp')
-rw-r--r--src/netbase.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp
index b44a8b16e2..6e81fdcac2 100644
--- a/src/netbase.cpp
+++ b/src/netbase.cpp
@@ -379,19 +379,21 @@ static bool Socks5(const std::string& strDest, int port, const ProxyCredentials
return error("Proxy failed to accept request");
}
if (pchRet2[1] != 0x00) {
+ // Failures to connect to a peer that are not proxy errors
CloseSocket(hSocket);
switch (pchRet2[1])
{
- case 0x01: return error("Proxy error: general failure");
- case 0x02: return error("Proxy error: connection not allowed");
- case 0x03: return error("Proxy error: network unreachable");
- case 0x04: return error("Proxy error: host unreachable");
- case 0x05: return error("Proxy error: connection refused");
- case 0x06: return error("Proxy error: TTL expired");
- case 0x07: return error("Proxy error: protocol error");
- case 0x08: return error("Proxy error: address type not supported");
- default: return error("Proxy error: unknown");
+ case 0x01: LogPrintf("Socks5() connect to %s:%d failed: general failure\n", strDest, port); break;
+ case 0x02: LogPrintf("Socks5() connect to %s:%d failed: connection not allowed\n", strDest, port); break;
+ case 0x03: LogPrintf("Socks5() connect to %s:%d failed: network unreachable\n", strDest, port); break;
+ case 0x04: LogPrintf("Socks5() connect to %s:%d failed: host unreachable\n", strDest, port); break;
+ case 0x05: LogPrintf("Socks5() connect to %s:%d failed: connection refused\n", strDest, port); break;
+ case 0x06: LogPrintf("Socks5() connect to %s:%d failed: TTL expired\n", strDest, port); break;
+ case 0x07: LogPrintf("Socks5() connect to %s:%d failed: protocol error\n", strDest, port); break;
+ case 0x08: LogPrintf("Socks5() connect to %s:%d failed: address type not supported\n", strDest, port); break;
+ default: LogPrintf("Socks5() connect to %s:%d failed: unknown\n", strDest, port);
}
+ return false;
}
if (pchRet2[2] != 0x00) {
CloseSocket(hSocket);