aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2015-04-19 12:34:43 -0700
committerGregory Maxwell <greg@xiph.org>2016-05-26 12:56:27 +0000
commitc769c4af11fc58dd4813d328c7f71042bc577676 (patch)
tree7c86c072c97dd185d723cc1bac363a3c34b000ff /src/net.h
parentf6b7df3155ddb4cedfbcf5d3eb3383d4614b3a85 (diff)
downloadbitcoin-c769c4af11fc58dd4813d328c7f71042bc577676.tar.xz
Avoid counting failed connect attempts when probably offline.
If a node is offline failed outbound connection attempts will crank up the addrman counter and effectively blow away our state. This change reduces the problem by only counting attempts made while the node believes it has outbound connections to at least two netgroups. Connect and addnode connections are also not counted, as there is no reason to unequally penalize them for their more frequent connections -- though there should be no real effect from this unless their addnode configureation is later removed. Wasteful repeated connection attempts while only a few connections are up are avoided via nLastTry. This is still somewhat incomplete protection because our outbound peers could be down but not timed out or might all be on 'local' networks (although the requirement for multiple netgroups helps).
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/net.h b/src/net.h
index 998ee49260..3332496c05 100644
--- a/src/net.h
+++ b/src/net.h
@@ -83,7 +83,7 @@ CNode* FindNode(const CNetAddr& ip);
CNode* FindNode(const CSubNet& subNet);
CNode* FindNode(const std::string& addrName);
CNode* FindNode(const CService& ip);
-bool OpenNetworkConnection(const CAddress& addrConnect, CSemaphoreGrant *grantOutbound = NULL, const char *strDest = NULL, bool fOneShot = false);
+bool OpenNetworkConnection(const CAddress& addrConnect, bool fCountFailure, CSemaphoreGrant *grantOutbound = NULL, const char *strDest = NULL, bool fOneShot = false);
void MapPort(bool fUseUPnP);
unsigned short GetListenPort();
bool BindListenPort(const CService &bindAddr, std::string& strError, bool fWhitelisted = false);