diff options
| author | Wladimir J. van der Laan <[email protected]> | 2017-02-09 08:52:34 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2017-02-09 08:53:22 +0100 |
| commit | 3ddfe298375c2484ac281d8a6d731ad8616f3542 (patch) | |
| tree | dcd28f2fc4e5481effaf87d771dc84e2cdc88f27 /src | |
| parent | netbase: Make InterruptibleRecv return an error code instead of bool (diff) | |
| download | discoin-3ddfe298375c2484ac281d8a6d731ad8616f3542.tar.xz discoin-3ddfe298375c2484ac281d8a6d731ad8616f3542.zip | |
netbase: Do not print an error on connection timeouts through proxy
If a timeout happens while reading the proxy response, this effectively
means we timed out while connecting to the remote node. This is very
common for Tor, so do not print an error message.
Diffstat (limited to 'src')
| -rw-r--r-- | src/netbase.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp index 414456a16..fc9a6ed0b 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -360,7 +360,14 @@ static bool Socks5(const std::string& strDest, int port, const ProxyCredentials char pchRet2[4]; if ((recvr = InterruptibleRecv(pchRet2, 4, SOCKS5_RECV_TIMEOUT, hSocket)) != IntrRecvError::OK) { CloseSocket(hSocket); - return error("Error while reading proxy response"); + if (recvr == IntrRecvError::Timeout) { + /* If a timeout happens here, this effectively means we timed out while connecting + * to the remote node. This is very common for Tor, so do not print an + * error message. */ + return false; + } else { + return error("Error while reading proxy response"); + } } if (pchRet2[0] != 0x05) { CloseSocket(hSocket); |