Compare commits

...

3 Commits

Author SHA1 Message Date
Aleksandr Bezobchuk
beb7557d77 p2p: logs++ 2021-07-23 10:24:12 -04:00
Aleksandr Bezobchuk
c69223d2c1 p2p: logs++ 2021-07-23 09:16:09 -04:00
Callum Waters
ca8b611ea8 add more p2p logs 2021-07-23 15:09:23 +02:00
2 changed files with 4 additions and 0 deletions

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", "err", err, "context", "P2P DEBUG")
return err
}

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, "context", "P2P DEBUG")
// 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", "err", err, "context", "P2P DEBUG")
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, "context", "P2P DEBUG")
return 0, nil, err
case <-c.closeCh:
return 0, nil, io.EOF