mirror of
https://github.com/logos-messaging/go-libp2p-rendezvous.git
synced 2026-01-04 05:43:06 +00:00
fix: avoid panic on empty result
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
This commit is contained in:
parent
2a4b093b3a
commit
7f8acdc3c4
@ -362,10 +362,13 @@ func (rp *rendezvousPoint) DiscoverSubscribe(ctx context.Context, ns string, ser
|
|||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
|
case result, ok := <-regCh:
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ch <- result.Peer
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return
|
return
|
||||||
case result := <-regCh:
|
|
||||||
ch <- result.Peer
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user