File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -1837,6 +1837,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
1837
1837
1838
1838
// First add all connected peers, preferring to list the connected address if available.
1839
1839
let connected_peers = self . peer_manager . get_peer_node_ids ( ) ;
1840
+ let connected_peers_len = connected_peers. len ( ) ;
1840
1841
for ( node_id, con_addr_opt) in connected_peers {
1841
1842
let stored_peer = self . peer_store . get_peer ( & node_id) ;
1842
1843
let stored_addr_opt = stored_peer. as_ref ( ) . map ( |p| p. address . clone ( ) ) ;
@@ -1854,7 +1855,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
1854
1855
1855
1856
// Now add all known-but-offline peers, too.
1856
1857
for p in self . peer_store . list_peers ( ) {
1857
- if peers. iter ( ) . find ( |d| d. node_id == p. node_id ) . is_some ( ) {
1858
+ if peers. iter ( ) . take ( connected_peers_len ) . find ( |d| d. node_id == p. node_id ) . is_some ( ) {
1858
1859
continue ;
1859
1860
}
1860
1861
You can’t perform that action at this time.
0 commit comments