Handle rejected peers properly

This commit is contained in:
wpetit 2019-04-07 15:56:04 +02:00
parent d550596d52
commit 1c468ff0fe
1 changed files with 7 additions and 0 deletions

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)
}