aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSuhas Daftuar <[email protected]>2019-02-26 15:04:48 -0500
committerSuhas Daftuar <[email protected]>2019-02-27 09:30:13 -0500
commit4991e3c813c9848d3b3957ea3ad433f02fca9e81 (patch)
treed68f196b83c23b139f21d228390b64373401eeef /src
parent[addrman] Improve tried table collision logging (diff)
downloaddiscoin-4991e3c813c9848d3b3957ea3ad433f02fca9e81.tar.xz
discoin-4991e3c813c9848d3b3957ea3ad433f02fca9e81.zip
[net] feeler connections can be made to outbound peers in same netgroup
Fixes a bug where feelers could be stuck trying to resolve a collision in the tried table that is to an address in the same netgroup as an existing outbound peer. Thanks to Muoi Tran for the original bug report and detailed debug logs to track this down.
Diffstat (limited to 'src')
-rw-r--r--src/net.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 87f1ef057..3f87dc635 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1765,9 +1765,15 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect)
addr = addrman.Select(fFeeler);
}
+ // Require outbound connections to be to distinct network groups
+ if (!fFeeler && setConnected.count(addr.GetGroup())) {
+ break;
+ }
+
// if we selected an invalid address, restart
- if (!addr.IsValid() || setConnected.count(addr.GetGroup()) || IsLocal(addr))
+ if (!addr.IsValid() || IsLocal(addr)) {
break;
+ }
// If we didn't find an appropriate destination after trying 100 addresses fetched from addrman,
// stop this loop, and let the outer loop run again (which sleeps, adds seed nodes, recalculates