|
|
@@ -100,7 +100,6 @@ pub trait DhtHandler {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- sleep(1).await;
|
|
|
let ping_res = self.ping(channel.clone()).await;
|
|
|
|
|
|
if let Err(e) = ping_res {
|
|
|
@@ -125,22 +124,6 @@ pub trait DhtHandler {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /// Remove disconnected nodes from the channel cache
|
|
|
- async fn disconnect_task(&self) -> Result<()> {
|
|
|
- loop {
|
|
|
- sleep(15).await;
|
|
|
-
|
|
|
- let channel_cache_lock = self.dht().channel_cache.clone();
|
|
|
- let mut channel_cache = channel_cache_lock.write().await;
|
|
|
- for (channel_id, _) in channel_cache.clone() {
|
|
|
- let channel = self.dht().p2p.get_channel(channel_id);
|
|
|
- if channel.is_none() {
|
|
|
- channel_cache.remove(&channel_id);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/// Add a node in the correct bucket
|
|
|
async fn add_node(&self, node: DhtNode) {
|
|
|
// Do not add ourselves to the buckets
|