mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-11 12:10:05 +00:00
fix handling of goodbye messages for limited peers (#13785)
Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
This commit is contained in:
parent
63c2b3563a
commit
c05e39a668
@ -42,9 +42,10 @@ func (s *Service) goodbyeRPCHandler(_ context.Context, msg interface{}, stream l
|
|||||||
return fmt.Errorf("wrong message type for goodbye, got %T, wanted *uint64", msg)
|
return fmt.Errorf("wrong message type for goodbye, got %T, wanted *uint64", msg)
|
||||||
}
|
}
|
||||||
if err := s.rateLimiter.validateRequest(stream, 1); err != nil {
|
if err := s.rateLimiter.validateRequest(stream, 1); err != nil {
|
||||||
return err
|
log.WithError(err).Warn("Goodbye message from rate-limited peer.")
|
||||||
|
} else {
|
||||||
|
s.rateLimiter.add(stream, 1)
|
||||||
}
|
}
|
||||||
s.rateLimiter.add(stream, 1)
|
|
||||||
log := log.WithField("Reason", goodbyeMessage(*m))
|
log := log.WithField("Reason", goodbyeMessage(*m))
|
||||||
log.WithField("peer", stream.Conn().RemotePeer()).Trace("Peer has sent a goodbye message")
|
log.WithField("peer", stream.Conn().RemotePeer()).Trace("Peer has sent a goodbye message")
|
||||||
s.cfg.p2p.Peers().SetNextValidTime(stream.Conn().RemotePeer(), goodByeBackoff(*m))
|
s.cfg.p2p.Peers().SetNextValidTime(stream.Conn().RemotePeer(), goodByeBackoff(*m))
|
||||||
|
Loading…
Reference in New Issue
Block a user