aboutsummaryrefslogtreecommitdiff
path: root/p2p/src/discovery/refresh.rs
diff options
context:
space:
mode:
authorhozan23 <hozan23@proton.me>2023-11-17 15:26:40 +0300
committerhozan23 <hozan23@proton.me>2023-11-17 15:32:24 +0300
commit44969b25504a4c91f45cac902f264579e8b90ca8 (patch)
tree3f435f0b28761bfdab992f2aad0a35cf1f6082b1 /p2p/src/discovery/refresh.rs
parentd016c8d40f6365052e549815ef734c1cabbfc364 (diff)
p2p: avoid doing too much locking and unlocking for the routing table mutex
Diffstat (limited to 'p2p/src/discovery/refresh.rs')
-rw-r--r--p2p/src/discovery/refresh.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/p2p/src/discovery/refresh.rs b/p2p/src/discovery/refresh.rs
index a708261..1ced266 100644
--- a/p2p/src/discovery/refresh.rs
+++ b/p2p/src/discovery/refresh.rs
@@ -130,14 +130,12 @@ impl RefreshService {
.notify(&DiscoveryEvent::RefreshStarted.into())
.await;
- let table = self.table.lock().await;
let mut entries: Vec<BucketEntry> = vec![];
- for bucket in table.iter() {
+ for bucket in self.table.lock().await.iter() {
for entry in bucket.random_iter(8) {
entries.push(entry.clone())
}
}
- drop(table);
self.clone().do_refresh(&entries).await;
}