diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/peering/fullmesh.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/peering/fullmesh.rs b/src/peering/fullmesh.rs index 5b73f4e..068055e 100644 --- a/src/peering/fullmesh.rs +++ b/src/peering/fullmesh.rs @@ -212,13 +212,13 @@ impl FullMeshPeeringStrategy { let strat2 = strat.clone(); netapp.on_connected(move |id: NodeID, addr: SocketAddr, is_incoming: bool| { let strat2 = strat2.clone(); - tokio::spawn(strat2.on_connected(id, addr, is_incoming)); + strat2.on_connected(id, addr, is_incoming); }); let strat2 = strat.clone(); netapp.on_disconnected(move |id: NodeID, is_incoming: bool| { let strat2 = strat2.clone(); - tokio::spawn(strat2.on_disconnected(id, is_incoming)); + strat2.on_disconnected(id, is_incoming); }); strat @@ -424,10 +424,12 @@ impl FullMeshPeeringStrategy { }; self.update_public_peer_list(&known_hosts); } + } else { + self.on_connected(id, addr, false); } } - async fn on_connected(self: Arc<Self>, id: NodeID, addr: SocketAddr, is_incoming: bool) { + fn on_connected(self: Arc<Self>, id: NodeID, addr: SocketAddr, is_incoming: bool) { if is_incoming { let mut known_hosts = self.known_hosts.write().unwrap(); if !known_hosts.list.contains_key(&id) { @@ -449,7 +451,7 @@ impl FullMeshPeeringStrategy { } } - async fn on_disconnected(self: Arc<Self>, id: NodeID, is_incoming: bool) { + fn on_disconnected(self: Arc<Self>, id: NodeID, is_incoming: bool) { if !is_incoming { info!("Connection to {} was closed", hex::encode(id)); let mut known_hosts = self.known_hosts.write().unwrap(); |