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: Show close reason after disconnect & close gracefully #16

Merged
merged 2 commits into from
Jan 29, 2025

Conversation

matheus23
Copy link
Member

@matheus23 matheus23 commented Jan 10, 2025

Depends on #15
(I need new iroh APIs.)

Description

Shows a close reason when the connection closes. E.g:

Test finished after 1.238599231s: connection lost (reason: closed by peer: 0)

This error message indicates that it's an intentional closing of the connection.
Otherwise it's something like:

Test finished after 1.238599231s: connection lost (reason: timed out)

This makes it easier to identify how the connection was lost.

Notes & open questions

Additionally, we ideally know if we closed the connection or if that was our peer. That info would be nice (but it's not as clear-cut, technically both could have closed the connection).
Also - using different error codes might be nice, but Endpoint::close doesn't support that yet. I'd like to at least separate a close from Ctrl+C with a close from e.g. a panic/Err.

Change checklist

  • Self-review.
  • [ ] Documentation updates following the style guide, if relevant.
  • [ ] Tests if relevant.
  • All breaking changes documented.

@matheus23 matheus23 self-assigned this Jan 10, 2025
Base automatically changed from ramfox/iroh-main to main January 14, 2025 20:01
@matheus23 matheus23 force-pushed the matheus23/close-reason branch from 278a854 to 443358b Compare January 21, 2025 07:43
@matheus23 matheus23 merged commit 917cb0f into main Jan 29, 2025
14 checks passed
@matheus23 matheus23 deleted the matheus23/close-reason branch January 29, 2025 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

1 participant