diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-12-02 17:43:42 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-12-02 17:54:16 +0100 |
commit | 35e408f8a48a5406cec214c1d660e6f6a2d026f3 (patch) | |
tree | b6d60a54e62f760266b4f854182eadf8c8438f20 /src/net.cpp | |
parent | 90f7aa777865864d5cf7d1f12af8ef37d851faab (diff) |
Regard connection failures as attempt for addrman
This avoids connecting to them again too soon in ThreadOpenConnections.
Make an exception for connection failures to the proxy as these
shouldn't affect the status of specific nodes.
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/net.cpp b/src/net.cpp index 6bf72d22c5..f1c49d0382 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -399,7 +399,9 @@ CNode* ConnectNode(CAddress addrConnect, const char *pszDest) // Connect SOCKET hSocket; - if (pszDest ? ConnectSocketByName(addrConnect, hSocket, pszDest, Params().GetDefaultPort()) : ConnectSocket(addrConnect, hSocket)) + bool proxyConnectionFailed = false; + if (pszDest ? ConnectSocketByName(addrConnect, hSocket, pszDest, Params().GetDefaultPort(), nConnectTimeout, &proxyConnectionFailed) : + ConnectSocket(addrConnect, hSocket, nConnectTimeout, &proxyConnectionFailed)) { addrman.Attempt(addrConnect); @@ -415,6 +417,10 @@ CNode* ConnectNode(CAddress addrConnect, const char *pszDest) pnode->nTimeConnected = GetTime(); return pnode; + } else if (!proxyConnectionFailed) { + // If connecting to the node failed, and failure is not caused by a problem connecting to + // the proxy, mark this as an attempt. + addrman.Attempt(addrConnect); } return NULL; |