Skip to content

Commit 3ddfe29

Browse files
committed
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.
1 parent 13f6085 commit 3ddfe29

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/netbase.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,14 @@ static bool Socks5(const std::string& strDest, int port, const ProxyCredentials
360360
char pchRet2[4];
361361
if ((recvr = InterruptibleRecv(pchRet2, 4, SOCKS5_RECV_TIMEOUT, hSocket)) != IntrRecvError::OK) {
362362
CloseSocket(hSocket);
363-
return error("Error while reading proxy response");
363+
if (recvr == IntrRecvError::Timeout) {
364+
/* If a timeout happens here, this effectively means we timed out while connecting
365+
* to the remote node. This is very common for Tor, so do not print an
366+
* error message. */
367+
return false;
368+
} else {
369+
return error("Error while reading proxy response");
370+
}
364371
}
365372
if (pchRet2[0] != 0x05) {
366373
CloseSocket(hSocket);

0 commit comments

Comments
 (0)