Skip to content

Commit

Permalink
log: Change stream-reset related errors' level from ERROR to WARN (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
AryanGodara authored Mar 7, 2024
1 parent e2197d9 commit 0b32df0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions p2p/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (serv *ExchangeServer[H]) requestHandler(stream network.Stream) {
pbreq := new(p2p_pb.HeaderRequest)
_, err = serde.Read(stream, pbreq)
if err != nil {
log.Errorw("server: reading header request from stream", "err", err)
log.Warnw("server: reading header request from stream", "err", err)
stream.Reset() //nolint:errcheck
return
}
Expand All @@ -115,7 +115,7 @@ func (serv *ExchangeServer[H]) requestHandler(stream network.Stream) {
case *p2p_pb.HeaderRequest_Origin:
headers, err = serv.handleRequest(pbreq.GetOrigin(), pbreq.GetOrigin()+pbreq.Amount)
default:
log.Error("server: invalid data type received")
log.Warn("server: invalid data type received")
stream.Reset() //nolint:errcheck
return
}
Expand Down Expand Up @@ -147,14 +147,14 @@ func (serv *ExchangeServer[H]) requestHandler(stream network.Stream) {
if !h.IsZero() {
bin, err = h.MarshalBinary()
if err != nil {
log.Errorw("server: marshaling header to proto", "height", h.Height, "err", err)
log.Warnw("server: marshaling header to proto", "height", h.Height, "err", err)
stream.Reset() //nolint:errcheck
return
}
}
_, err = serde.Write(stream, &p2p_pb.HeaderResponse{Body: bin, StatusCode: code})
if err != nil {
log.Errorw("server: writing header to stream", "err", err)
log.Warnw("server: writing header to stream", "err", err)
stream.Reset() //nolint:errcheck
return
}
Expand Down

0 comments on commit 0b32df0

Please sign in to comment.