Skip to content

Commit c6b77ab

Browse files
committed
bugfix - remove deadlock when pinging bootnodes
1 parent 140d2d1 commit c6b77ab

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

trin-state/src/network.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ impl StateNetwork {
3535
// Trigger bonding with bootnodes, at both the base layer and portal overlay.
3636
// The overlay ping via talkreq will trigger a session at the base layer, then
3737
// a session on the (overlay) portal network.
38-
let guard = self.overlay.discovery.read_with_warn().await;
39-
for enr in guard.discv5.table_entries_enr() {
38+
let table_entries = {
39+
// use a nested scope so that the guard is quickly dropped
40+
let guard = self.overlay.discovery.read_with_warn().await;
41+
guard.discv5.table_entries_enr()
42+
};
43+
for enr in table_entries {
4044
debug!("Attempting bond with bootnode {}", enr);
4145
let ping_result = self
4246
.overlay

0 commit comments

Comments
 (0)