n0-computer / iroh

peer-2-peer that just works
https://iroh.computer
Apache License 2.0
2.6k stars 164 forks source link

fix(iroh-net): Make sure the rtt-actor is shutdown correctly #2914

Closed flub closed 1 week ago

flub commented 2 weeks ago

Description

When the endpoint is dropped the rtt-actor should be shut down. This makes sure this actually happens.

Fixes #2911

Breaking Changes

Notes & open questions

Also make sure the task is aborted on drop. We should always do this anyway.

Change checklist

github-actions[bot] commented 2 weeks ago

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/2914/docs/iroh/

Last updated: 2024-11-12T10:19:16Z

github-actions[bot] commented 2 weeks ago

Netsim report & logs for this PR have been generated and is available at: LOGS This report will remain available for 3 days.

Last updated for commit: c4593f7

PaulOlteanu commented 1 week ago

I believe the else branch will only execute if none of the other branch's patterns match. Since the _ = cleanup_interval.tick() pattern can never not match, the else branch won't ever execute.

flub commented 1 week ago

I believe the else branch will only execute if none of the other branch's patterns match. Since the _ = cleanup_interval.tick() pattern can never not match, the else branch won't ever execute.

@PaulOlteanu thanks for the insight! I guess my metal model of select's branch matching is all wrong.

The docs say that the first branch that completes is returned and all other futures are cancelled. So I was considering at that point there's one value, None, which does not match its pattern so the else branch is executed.

Re-reading the docs:

If the pattern does not match, disable the current branch for the remainder of the current call to select!. Continue from step 3.

So this is why I had this totally wrong, as long as there are enabled branches select does not move on to the else branch or return.

Thanks for making me realise what I had done wrong!

flub commented 1 week ago

github actions network issues it seems like? try again