Handle rejected peers properly

This commit is contained in:
wpetit 2019-04-07 15:56:04 +02:00
parent d550596d52
commit 1c468ff0fe

View File

@ -71,6 +71,13 @@ func Authenticate(store peering.Store, key *rsa.PublicKey, funcs ...OptionFunc)
return
}
sendError(w, http.StatusUnauthorized)
case ErrPeerRejected:
if err := store.UpdateLastContact(serverClaims.PeerID, r.RemoteAddr, time.Now()); err != nil {
logger.Printf("[ERROR] %s", err)
sendError(w, http.StatusInternalServerError)
return
}
sendError(w, http.StatusForbidden)
default:
sendError(w, http.StatusInternalServerError)
}