add more p2p logs

This commit is contained in:
Callum Waters
2021-07-23 15:09:23 +02:00
parent a393cf8bab
commit ca8b611ea8
2 changed files with 4 additions and 0 deletions
+1
View File
@@ -905,6 +905,7 @@ func (r *Router) receivePeer(peerID types.NodeID, conn Connection) error {
for {
chID, bz, err := conn.ReceiveMessage()
if err != nil {
r.logger.Error("received error from receive message")
return err
}
+3
View File
@@ -362,11 +362,13 @@ func (c *mConnConnection) onError(e interface{}) {
if !ok {
err = fmt.Errorf("%v", err)
}
c.logger.Error("error from connection", "err", err)
// We have to close the connection here, since MConnection will have stopped
// the service on any errors.
_ = c.Close()
select {
case c.errorCh <- err:
c.logger.Error("adding error to channel")
case <-c.closeCh:
}
}
@@ -410,6 +412,7 @@ func (c *mConnConnection) TrySendMessage(chID ChannelID, msg []byte) (bool, erro
func (c *mConnConnection) ReceiveMessage() (ChannelID, []byte, error) {
select {
case err := <-c.errorCh:
c.logger.Error("propagating error message to router", "err", err)
return 0, nil, err
case <-c.closeCh:
return 0, nil, io.EOF