-
Notifications
You must be signed in to change notification settings - Fork 288
refactor(iroh): Remove CancellationToken from Endpoint #3101
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -248,9 +248,8 @@ impl RouterBuilder { | |
let mut join_set = JoinSet::new(); | ||
let endpoint = self.endpoint.clone(); | ||
|
||
// We use a child token of the endpoint, to ensure that this is shutdown | ||
// when the endpoint is shutdown, but that we can shutdown ourselves independently. | ||
let cancel = endpoint.cancel_token().child_token(); | ||
// Our own shutdown works with a cancellation token. | ||
let cancel = CancellationToken::new(); | ||
let cancel_token = cancel.clone(); | ||
|
||
let run_loop_fut = async move { | ||
|
@@ -289,7 +288,7 @@ impl RouterBuilder { | |
// handle incoming p2p connections. | ||
incoming = endpoint.accept() => { | ||
let Some(incoming) = incoming else { | ||
break; | ||
break; // Endpoint is closed. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need to cancel the token here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, but we should probably cancel the token around the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line 257 above makes a drop guard from the cancel_token. Isn't that sufficient? Or do we think this is being dropped too late? |
||
}; | ||
|
||
let protocols = protocols.clone(); | ||
|
Uh oh!
There was an error while loading. Please reload this page.