Browse Source

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.
0.15
Wladimir J. van der Laan 8 years ago
parent
commit
3ddfe29837
  1. 7
      src/netbase.cpp

7
src/netbase.cpp

@ -360,8 +360,15 @@ static bool Socks5(const std::string& strDest, int port, const ProxyCredentials
char pchRet2[4]; char pchRet2[4];
if ((recvr = InterruptibleRecv(pchRet2, 4, SOCKS5_RECV_TIMEOUT, hSocket)) != IntrRecvError::OK) { if ((recvr = InterruptibleRecv(pchRet2, 4, SOCKS5_RECV_TIMEOUT, hSocket)) != IntrRecvError::OK) {
CloseSocket(hSocket); CloseSocket(hSocket);
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"); return error("Error while reading proxy response");
} }
}
if (pchRet2[0] != 0x05) { if (pchRet2[0] != 0x05) {
CloseSocket(hSocket); CloseSocket(hSocket);
return error("Proxy failed to accept request"); return error("Proxy failed to accept request");

Loading…
Cancel
Save