feat: only show warn in log when peer id is already used
Cadoles/go-http-peering/pipeline/head There was a failure building this commit
Details
Cadoles/go-http-peering/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
834f6346dd
commit
635f170762
|
@ -54,9 +54,8 @@ func AdvertiseHandler(store peering.Store, key *rsa.PublicKey, funcs ...OptionFu
|
|||
return
|
||||
}
|
||||
|
||||
peer, err := store.Get(serverClaims.PeerID)
|
||||
if err == nil {
|
||||
logger.Printf("[ERROR] %+v", errors.WithStack(ErrPeerIDAlreadyInUse))
|
||||
if _, err := store.Get(serverClaims.PeerID); err == nil {
|
||||
logger.Printf("[WARN] %s", errors.WithStack(ErrPeerIDAlreadyInUse))
|
||||
options.ErrorHandler(w, r, ErrPeerIDAlreadyInUse)
|
||||
return
|
||||
}
|
||||
|
@ -69,7 +68,7 @@ func AdvertiseHandler(store peering.Store, key *rsa.PublicKey, funcs ...OptionFu
|
|||
|
||||
attrs := filterAttributes(options.PeerAttributes, advertising.Attributes)
|
||||
|
||||
peer, err = store.Create(serverClaims.PeerID, attrs)
|
||||
peer, err := store.Create(serverClaims.PeerID, attrs)
|
||||
if err != nil {
|
||||
logger.Printf("[ERROR] %+v", errors.WithStack(err))
|
||||
options.ErrorHandler(w, r, err)
|
||||
|
|
Loading…
Reference in New Issue