mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-11 17:31:35 +00:00
p2p/discover: fix deadlock in waitForNodes by buffering subscriber channel
This commit is contained in:
parent
aaa2b66285
commit
d15e833a43
1 changed files with 1 additions and 1 deletions
|
|
@ -769,7 +769,7 @@ func (tab *Table) waitForNodes(ctx context.Context, n int) error {
|
||||||
}
|
}
|
||||||
if ch == nil {
|
if ch == nil {
|
||||||
// Init subscription.
|
// Init subscription.
|
||||||
ch = make(chan *enode.Node)
|
ch = make(chan *enode.Node, 1)
|
||||||
sub := tab.nodeFeed.Subscribe(ch)
|
sub := tab.nodeFeed.Subscribe(ch)
|
||||||
defer sub.Unsubscribe()
|
defer sub.Unsubscribe()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue