New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding logging around libp2p one-to-one stream management #785
Conversation
@@ -277,13 +277,13 @@ func (m *Middleware) SendDirect(msg *message.Message, targetID flow.Identifier) | |||
// flush the stream | |||
err = bufw.Flush() | |||
if err != nil { | |||
return fmt.Errorf("failed to flush stream for %s: %w", targetID.String(), err) | |||
return fmt.Errorf("failed to flush stream for %s: %w", targetIdentity.String(), err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
identity gives IP address in addition to node id.
@@ -79,7 +79,7 @@ func (rc *readConnection) receiveLoop(wg *sync.WaitGroup) { | |||
rc.closeStream() | |||
return | |||
} | |||
rc.log.Error().Err(err) | |||
rc.log.Error().Err(err).Msg("failed to read message") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger won't print log if there is no Msg
field.
@@ -120,12 +118,3 @@ func (rc *readConnection) resetStream() { | |||
rc.log.Error().Err(err).Msg("failed to reset stream") | |||
} | |||
} | |||
|
|||
func streamLogger(log zerolog.Logger, stream libp2pnetwork.Stream) zerolog.Logger { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved this to libp2pUtils.go
Codecov Report
@@ Coverage Diff @@
## master #785 +/- ##
==========================================
- Coverage 56.42% 56.42% -0.01%
==========================================
Files 423 423
Lines 24793 24789 -4
==========================================
- Hits 13990 13987 -3
+ Misses 8909 8907 -2
- Partials 1894 1895 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
To help debug the stream reset issue, I have made some minor logging changes.