fix: variable bad scoping
Some checks reported warnings
Cadoles/go-http-peering/pipeline/head This commit is unstable

This commit is contained in:
wpetit 2024-01-05 16:17:39 +01:00
parent 635f170762
commit 51bdf4d015

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