mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-06 14:41:21 +00:00
Fix panic in raw swarm (#571)
This commit is contained in:
parent
840663e181
commit
a77c1a6bf7
@ -720,14 +720,15 @@ where
|
|||||||
};
|
};
|
||||||
|
|
||||||
let closed_endpoint = reach_attempts.connected_points
|
let closed_endpoint = reach_attempts.connected_points
|
||||||
.insert(event.peer_id().clone(), opened_endpoint.clone())
|
.insert(event.peer_id().clone(), opened_endpoint.clone());
|
||||||
.expect("We insert into connected_points whenever a connection is opened and remove \
|
|
||||||
only when a connection is closed ; the underlying API is guaranteed to always \
|
|
||||||
deliver a connection closed message after it has been opened, and no two \
|
|
||||||
closed messages ; qed");
|
|
||||||
|
|
||||||
let (outcome, peer_id) = event.accept();
|
let (outcome, peer_id) = event.accept();
|
||||||
if outcome == CollectionNodeAccept::ReplacedExisting {
|
if outcome == CollectionNodeAccept::ReplacedExisting {
|
||||||
|
let closed_endpoint = closed_endpoint
|
||||||
|
.expect("We insert into connected_points whenever a connection is opened and \
|
||||||
|
remove only when a connection is closed ; the underlying API is guaranteed \
|
||||||
|
to always deliver a connection closed message after it has been opened, \
|
||||||
|
and no two closed messages ; qed");
|
||||||
return (Default::default(), RawSwarmEvent::Replaced {
|
return (Default::default(), RawSwarmEvent::Replaced {
|
||||||
peer_id,
|
peer_id,
|
||||||
endpoint: opened_endpoint,
|
endpoint: opened_endpoint,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user