aboutsummaryrefslogtreecommitdiff
path: root/src/peering/fullmesh.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/peering/fullmesh.rs')
-rw-r--r--src/peering/fullmesh.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/peering/fullmesh.rs b/src/peering/fullmesh.rs
index 4e9a78d..1b26489 100644
--- a/src/peering/fullmesh.rs
+++ b/src/peering/fullmesh.rs
@@ -177,20 +177,20 @@ impl FullMeshPeeringStrategy {
);
let strat2 = strat.clone();
- netapp.on_connected.store(Some(Arc::new(Box::new(
+ netapp.on_connected(
move |pk: ed25519::PublicKey, addr: SocketAddr, is_incoming: bool| {
let strat2 = strat2.clone();
tokio::spawn(strat2.on_connected(pk, addr, is_incoming));
},
- ))));
+ );
let strat2 = strat.clone();
- netapp.on_disconnected.store(Some(Arc::new(Box::new(
+ netapp.on_disconnected(
move |pk: ed25519::PublicKey, is_incoming: bool| {
let strat2 = strat2.clone();
tokio::spawn(strat2.on_disconnected(pk, is_incoming));
},
- ))));
+ );
strat
}
@@ -271,7 +271,7 @@ impl FullMeshPeeringStrategy {
hex::encode(id),
ping_time
);
- match self.netapp.request(&id, ping_msg, prio::HIGH).await {
+ match self.netapp.request(&id, ping_msg, PRIO_HIGH).await {
Err(e) => warn!("Error pinging {}: {}", hex::encode(id), e),
Ok(ping_resp) => {
let resp_time = Instant::now();
@@ -300,7 +300,7 @@ impl FullMeshPeeringStrategy {
async fn exchange_peers(self: Arc<Self>, id: &ed25519::PublicKey) {
let peer_list = KnownHosts::map_into_vec(&self.known_hosts.read().unwrap().list);
let pex_message = PeerListMessage { list: peer_list };
- match self.netapp.request(id, pex_message, prio::BACKGROUND).await {
+ match self.netapp.request(id, pex_message, PRIO_BACKGROUND).await {
Err(e) => warn!("Error doing peer exchange: {}", e),
Ok(resp) => {
self.handle_peer_list(&resp.list[..]);