From d51acba9bee82b0d16d0ab03f7d6dab862a3ebec Mon Sep 17 00:00:00 2001 From: Igor Katson Date: Sun, 10 Oct 2021 10:45:58 +0100 Subject: [PATCH] Fix a bug in DHT that caused panics sometimes --- crates/dht/src/dht.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/dht/src/dht.rs b/crates/dht/src/dht.rs index ef56727..ae30b02 100644 --- a/crates/dht/src/dht.rs +++ b/crates/dht/src/dht.rs @@ -584,7 +584,7 @@ impl Stream for PeerStream { .unwrap() .get_index(pos) .unwrap(); - if pos < end { + if pos + 1 < end { self.initial_peers_pos = Some((pos + 1, end)); } self.absolute_stream_pos += 1;