aboutsummaryrefslogtreecommitdiff
path: root/src/peering
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-10-21 12:24:42 +0200
committerAlex Auvolat <alex@adnab.me>2021-10-21 12:24:42 +0200
commitd15378a2245b30fa2094c95bd942c94361f06c4c (patch)
tree0b756a729d19827d5be2ab2b9b945ba813b5d6b9 /src/peering
parent94c01a3565f0f5804ea096370aced22f8e4a723a (diff)
downloadnetapp-d15378a2245b30fa2094c95bd942c94361f06c4c.tar.gz
netapp-d15378a2245b30fa2094c95bd942c94361f06c4c.zip
invoke handler that wasn't invoked
Diffstat (limited to 'src/peering')
-rw-r--r--src/peering/fullmesh.rs10
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();