From fda3064ab1f7902e59110dd3acbe008abfcbc7f1 Mon Sep 17 00:00:00 2001 From: YACOVM Date: Wed, 8 Mar 2017 10:33:38 +0200 Subject: [PATCH] [FAB-2689] Limit conn attempts to bootstrap peers In gossip, when a peer starts up- it tries to connect to the bootstrap set indefinitely. This needs to be limited up to a finite number. Change-Id: I9a0e8290dbda5489325aa4ce3c0b2f33122b252b Signed-off-by: Yacov Manevich --- gossip/discovery/discovery_impl.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gossip/discovery/discovery_impl.go b/gossip/discovery/discovery_impl.go index 53d464e7538..dc6ddfe1769 100644 --- a/gossip/discovery/discovery_impl.go +++ b/gossip/discovery/discovery_impl.go @@ -179,7 +179,7 @@ func (d *gossipDiscoveryImpl) connect2BootstrapPeers(endpoints []string) { return } - for !d.somePeerIsKnown() { + for i := 0; i < maxConnectionAttempts && !d.somePeerIsKnown() && !d.toDie(); i++ { var wg sync.WaitGroup req := d.createMembershipRequest(true).NoopSign() wg.Add(len(endpoints))