aboutsummaryrefslogtreecommitdiff
path: root/src/sync.h
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2016-12-11 04:39:26 +0000
committerGregory Maxwell <greg@xiph.org>2017-01-05 19:02:09 +0000
commit50bd12ce0c49e574a5baf1a8df3a667810c6ad1e (patch)
treef17cee354b55a4acf8e75f29cb916d07fc00c0d7 /src/sync.h
parentce43630d1e97368f454ad6a7b65a24263ab5be71 (diff)
downloadbitcoin-50bd12ce0c49e574a5baf1a8df3a667810c6ad1e.tar.xz
Break addnode out from the outbound connection limits.
Previously addnodes were in competition with outbound connections for access to the eight outbound slots. One result of this is that frequently a node with several addnode configured peers would end up connected to none of them, because while the addnode loop was in its two minute sleep the automatic connection logic would fill any free slots with random peers. This is particularly unwelcome to users trying to maintain links to specific nodes for fast block relay or purposes. Another result is that a group of nine or more nodes which are have addnode configured towards each other can become partitioned from the public network. This commit introduces a new limit of eight connections just for addnode peers which is not subject to any of the other connection limitations (including maxconnections). The choice of eight is sufficient so that under no condition would a user find themselves connected to fewer addnoded peers than previously. It is also low enough that users who are confused about the significance of more connections and have gotten too copy-and-paste happy will not consume more than twice the slot usage of a typical user. Any additional load on the network resulting from this will likely be offset by a reduction in users applying even more wasteful workaround for the prior behavior. The retry delays are reduced to avoid nodes sitting around without their added peers up, but are still sufficient to prevent overly aggressive repeated connections. The reduced delays also make the system much more responsive to the addnode RPC. Ban-disconnects are also exempted for peers added via addnode since the outbound addnode logic ignores bans. Previously it would ban an addnode then immediately reconnect to it. A minor change was also made to CSemaphoreGrant so that it is possible to re-acquire via an object whos grant was moved.
Diffstat (limited to 'src/sync.h')
-rw-r--r--src/sync.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/src/sync.h b/src/sync.h
index 680d603044..3b29050e0e 100644
--- a/src/sync.h
+++ b/src/sync.h
@@ -264,7 +264,6 @@ public:
grant.Release();
grant.sem = sem;
grant.fHaveGrant = fHaveGrant;
- sem = NULL;
fHaveGrant = false;
}