fix(p2p): don't discard reason sent by Disconnect() #16559#2009
fix(p2p): don't discard reason sent by Disconnect() #16559#2009AnilChinchawale merged 1 commit intoXinFinOrg:dev-upgradefrom
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where the disconnect reason passed to Peer.Disconnect() was being discarded in the peer's run loop. When Disconnect() is called with a specific reason, that reason is sent through the p.disc channel, but the run loop was not extracting this reason before closing the connection, resulting in a default reason being used instead.
Changes:
- Added missing
reason = discReasonForError(err)assignment when receiving fromp.discchannel to properly handle the disconnect reason sent byDisconnect()
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3d730e9 to
6621bec
Compare
Proposed changes
Ref: ethereum#16559
Types of changes
What types of changes does your code introduce to XDC network?
Put an
✅in the boxes that applyImpacted Components
Which part of the codebase this PR will touch base on,
Put an
✅in the boxes that applyChecklist
Put an
✅in the boxes once you have confirmed below actions (or provide reasons on not doing so) that