From d93769b0fda11650a5dcbefe2e8d35313f4dc156 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 11 Feb 2019 16:04:23 +0100 Subject: [PATCH] Fix infinite loop in reserved mode (#1759) --- substrate/core/network-libp2p/src/custom_proto/behaviour.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/substrate/core/network-libp2p/src/custom_proto/behaviour.rs b/substrate/core/network-libp2p/src/custom_proto/behaviour.rs index 92bc725afe..20fb8d0e9e 100644 --- a/substrate/core/network-libp2p/src/custom_proto/behaviour.rs +++ b/substrate/core/network-libp2p/src/custom_proto/behaviour.rs @@ -319,6 +319,10 @@ impl CustomProtos { // We're done with reserved node; return early if there's nothing more to do. if self.reserved_only { + // We set a timeout to 60 seconds for trying to connect again, however in practice + // a round will happen as soon as we fail to dial, disconnect from a node, allow + // unreserved nodes, and so on. + self.next_connect_to_nodes.reset(Instant::now() + Duration::from_secs(60)); return }