p2p/discover: update

This commit is contained in:
Felix Lange 2026-05-07 18:54:50 +02:00
parent 0e9e8a479a
commit c3f17e6172

View file

@ -797,15 +797,15 @@ func (tab *Table) waitForNodes(ctx context.Context, n int) error {
return nil
}
if notify == nil {
// Lazily init the subscription.
// Lazily init the subscription. Do this while holding the
// lock so we don't miss any events that change the node count.
sub := initsub()
defer sub.Unsubscribe()
}
tab.mutex.Unlock()
// Wait for table event.
_, ok := <-notify
if !ok {
if _, ok := <-notify; !ok {
break
}
}