aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@exmulti.com>2012-07-03 19:51:08 -0700
committerJeff Garzik <jgarzik@exmulti.com>2012-07-03 19:51:08 -0700
commit38986093045f252753e35b3d9d4c3e2ad0c82af3 (patch)
treee3b2680b3127c50055acd96bea74262c81070ac3
parent3ee48ba20a5ef6fd41941dc5089b0279eff30aea (diff)
parent19521acfa4499bb50105e13b5ffd63bfd43c73aa (diff)
Merge pull request #1546 from gmaxwell/allowsamenetinbound
Do not consider inbound peers for outbound network group exclusion.
-rw-r--r--src/net.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 9d32d0924a..e10829aca3 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1430,16 +1430,17 @@ void ThreadOpenConnections2(void* parg)
//
CAddress addrConnect;
- // Only connect to one address per a.b.?.? range.
+ // Only connect out to one peer per network group (/16 for IPv4).
// Do this here so we don't have to critsect vNodes inside mapAddresses critsect.
int nOutbound = 0;
set<vector<unsigned char> > setConnected;
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes) {
- setConnected.insert(pnode->addr.GetGroup());
- if (!pnode->fInbound)
+ if (!pnode->fInbound) {
+ setConnected.insert(pnode->addr.GetGroup());
nOutbound++;
+ }
}
}