mirror of
https://github.com/logos-messaging/go-waku-rendezvous.git
synced 2026-01-07 07:33:10 +00:00
fix: no peers available
This commit is contained in:
parent
ba3a59f225
commit
58fe0c6241
@ -2,6 +2,7 @@ package rendezvous
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"time"
|
||||
@ -71,6 +72,11 @@ func (r *rendezvousPoint) getRandomPeer() (peer.ID, error) {
|
||||
peerIDs = append(peerIDs, peer)
|
||||
}
|
||||
}
|
||||
|
||||
if len(peerIDs) == 0 {
|
||||
return "", errors.New("no peers available")
|
||||
}
|
||||
|
||||
return peerIDs[rand.Intn(len(peerIDs))], nil // nolint: gosec
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user