nit: add peer info when logging write errors

Signed-off-by: Leo Chen <leo@harmony.one>
pull/399/head
Leo Chen 6 years ago
parent 65d3e56e67
commit 993ec605c9
  1. 3
      p2p/host/hostv2/hostv2.go

@ -190,7 +190,8 @@ func (host *HostV2) SendMessage(p p2p.Peer, message []byte) error {
return p2p.ErrNewStream return p2p.ErrNewStream
} }
if nw, err := s.Write(message); err != nil { if nw, err := s.Write(message); err != nil {
logger.Error("Write() failed", "error", err) logger.Error("Write() failed", "peerID", p.PeerID,
"protocolID", ProtocolID, "error", err)
return p2p.ErrMsgWrite return p2p.ErrMsgWrite
} else if nw < len(message) { } else if nw < len(message) {
logger.Error("Short Write()", "expected", len(message), "actual", nw) logger.Error("Short Write()", "expected", len(message), "actual", nw)

Loading…
Cancel
Save