fix: set max limit to 50 nodes and fix empty peer id

This commit is contained in:
Richard Ramos 2021-09-30 11:46:20 -04:00
parent 58fe0c6241
commit 020ef08b26
No known key found for this signature in database
GPG Key ID: 80D4B01265FDFE8F
2 changed files with 3 additions and 2 deletions

View File

@ -68,7 +68,7 @@ func (c *rendezvousDiscovery) FindPeers(ctx context.Context, ns string, opts ...
return nil, err
}
const maxLimit = 1000
const maxLimit = 50
limit := options.Limit
if limit == 0 || limit > maxLimit {
limit = maxLimit

3
svc.go
View File

@ -172,7 +172,8 @@ func (rz *RendezvousService) handleRegister(p peer.ID, m *pb.Message_Register) *
mpid := mpi.GetId()
var mp peer.ID
if mpid != nil {
mp, err := peer.IDFromBytes(mpid)
var err error
mp, err = peer.IDFromBytes(mpid)
if err != nil {
return newRegisterResponseError(pb.Message_E_INVALID_PEER_INFO, "bad peer id")
}