invoke handler that wasn't invoked

This commit is contained in:
Alex 2021-10-21 12:24:42 +02:00
parent 94c01a3565
commit d15378a224
No known key found for this signature in database
GPG key ID: EDABF9711E244EB1

View file

@ -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();