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(relay): emit event when client connections are dropped #5869

Merged
merged 2 commits into from
Feb 27, 2025

Conversation

RolandSherwin
Copy link
Contributor

Description

When a relay server has no more connection with a reserved client, it would remove the reservation and the drop the circuits without any information passed to the server. It will be useful to for a server to track all its reservations and to know when they're removed (without keeping track of the connections themselves).

This PR aims to notify the server when a reservation closes, with the emission of the following event

    /// A reservation has been closed.
    ReservationClosed { src_peer_id: PeerId },

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

@RolandSherwin RolandSherwin force-pushed the close_reservation_on_zero_conn branch 2 times, most recently from 7f11002 to 1664632 Compare February 18, 2025 14:39
@RolandSherwin RolandSherwin force-pushed the close_reservation_on_zero_conn branch 2 times, most recently from ff5da99 to 961b273 Compare February 24, 2025 15:11
Copy link
Contributor

@elenaf9 elenaf9 left a comment

Choose a reason for hiding this comment

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

One nit about the changelog entry, rest LGTM.
Thanks @RolandSherwin!

@RolandSherwin RolandSherwin force-pushed the close_reservation_on_zero_conn branch from bfd945b to 8fc7efe Compare February 25, 2025 10:10
@RolandSherwin RolandSherwin force-pushed the close_reservation_on_zero_conn branch from 8fc7efe to 4b4e462 Compare February 25, 2025 14:37
@RolandSherwin RolandSherwin changed the title feat(relay): emit event when all client connections are dropped feat(relay): emit event when client connections are dropped Feb 25, 2025
elenaf9
elenaf9 previously approved these changes Feb 25, 2025
Copy link
Contributor

@elenaf9 elenaf9 left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @RolandSherwin!

@elenaf9
Copy link
Contributor

elenaf9 commented Feb 25, 2025

Ah sorry, metrics also needs version bump (only patch version though) and changelog entry.

@RolandSherwin RolandSherwin force-pushed the close_reservation_on_zero_conn branch from a9efc87 to 39ec7d5 Compare February 27, 2025 21:31
@RolandSherwin
Copy link
Contributor Author

No worries! I've pushed the changes there. @elenaf9

@mergify mergify bot dismissed elenaf9’s stale review February 27, 2025 21:31

Approvals have been dismissed because the PR was updated after the send-it label was applied.

@dariusc93 dariusc93 removed the send-it label Feb 27, 2025
@dariusc93 dariusc93 requested a review from elenaf9 February 27, 2025 21:35
@mergify mergify bot merged commit e244b98 into libp2p:master Feb 27, 2025
71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants