fix: variable bad scoping
Cadoles/go-http-peering/pipeline/head This commit is unstable Details

This commit is contained in:
wpetit 2024-01-05 16:17:39 +01:00
parent 635f170762
commit 51bdf4d015
1 changed files with 3 additions and 2 deletions

View File

@ -54,13 +54,14 @@ func AdvertiseHandler(store peering.Store, key *rsa.PublicKey, funcs ...OptionFu
return
}
if _, err := store.Get(serverClaims.PeerID); err == nil {
_, err = store.Get(serverClaims.PeerID)
if err == nil {
logger.Printf("[WARN] %s", errors.WithStack(ErrPeerIDAlreadyInUse))
options.ErrorHandler(w, r, ErrPeerIDAlreadyInUse)
return
}
if err != peering.ErrPeerNotFound {
if !errors.Is(err, peering.ErrPeerNotFound) {
logger.Printf("[ERROR] %+v", errors.WithStack(err))
options.ErrorHandler(w, r, err)
return