Skip to content
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

feat(p2p): send goodbye messages on disconnecting to peers #10920

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

Maddiaa0
Copy link
Member

@Maddiaa0 Maddiaa0 commented Dec 20, 2024

Overview

When shutting down the node, or when disconnecting from a node that has suffered from a low peer score, we send a good bye message.
This goodbye message prompts the other node to also close their connection, allowing them to connect to more peers

Features:

  • Adds a goodbye message to reqresp such that peers can be sent a goodbye message along with a reason when they are disconnected from the peer set

Misc:

  • Did some refactoring of the reqresp code to make it more managable
  • Do avoid a circular ref when passing reqresp to the peer manager to allow it to send goodbyes, it was required
    to split out the peer scoring component such that reqresp could still manage peer scores
  • Replaced ReqResp constant strings with enums
  • Moved ReqResp handlers into their own files, so they are easier to reason about

Copy link
Member Author

Maddiaa0 commented Dec 20, 2024

@@ -144,95 +143,6 @@ export class LibP2PService<T extends P2PClientType> extends WithTracer implement
};
}

/**
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just moved start and stop below the static initialiser just so that it was closer to the constructor

private proofVerifier: ClientProtocolCircuitVerifier,
private worldStateSynchronizer: WorldStateSynchronizer,
private telemetry: TelemetryClient,
private requestResponseHandlers: ReqRespSubProtocolHandlers = DEFAULT_SUB_PROTOCOL_HANDLERS,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea why i included these as a dependency, they are now just constructed in the start function, alongside the validators

@Maddiaa0 Maddiaa0 force-pushed the md/ping-and-goodbye branch from 7f1e79d to fa2d595 Compare December 20, 2024 22:29
Base automatically changed from md/peer-manager-improvements to master December 20, 2024 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant