From 0de0a39291f47b0283fbe0c1702e5e029a6f85b5 Mon Sep 17 00:00:00 2001 From: Wilmer Paulino Date: Wed, 8 Aug 2018 13:13:52 -0700 Subject: [PATCH] server: prevent increasing epochErrors if conn was established In this commit, we fix a small bug where we would increase epochErrors by one even if connections were successfully established. Due to this, we would stay stuck inside of the peer bootstrapper loop without requerying for new peers. --- server.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server.go b/server.go index f8e5664a..f03a22fa 100644 --- a/server.go +++ b/server.go @@ -1346,6 +1346,10 @@ func (s *server) peerBootstrapper(numTargetPeers uint32, s.connectToPeer(a, errChan) select { case err := <-errChan: + if err == nil { + return + } + srvrLog.Errorf("Unable to "+ "connect to %v: %v", a, err) @@ -1413,6 +1417,9 @@ func (s *server) initialPeerBootstrap(ignore map[autopilot.NodeID]struct{}, // us down. select { case err := <-errChan: + if err == nil { + return + } srvrLog.Errorf("Unable to connect to "+ "%v: %v", addr, err) // TODO: tune timeout? 3 seconds might be *too*