Add logs when rate limited peer

This commit is contained in:
Andrea Maria Piana 2020-12-04 07:56:48 +01:00
parent 14f4c40404
commit 1237cc9ac6
1 changed files with 3 additions and 1 deletions

View File

@ -1099,7 +1099,9 @@ func (w *Waku) HandlePeer(peer common.Peer, rw p2p.MsgReadWriter) error {
if w.rateLimiter != nil {
runLoop := func(out p2p.MsgReadWriter) error {
peer.SetRWWriter(out)
return peer.Run()
err := peer.Run()
w.logger.Info("handled peer", zap.String("peerID", types.EncodeHex(peer.ID())), zap.Error(err))
return err
}
return w.rateLimiter.Decorate(peer, rw, runLoop)
}