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

Handle timeout in the client IO task #1109

Merged
merged 3 commits into from
Jan 24, 2024

Conversation

mkeeter
Copy link
Contributor

@mkeeter mkeeter commented Jan 24, 2024

This PR moves the timeout into the client IO task, for consistency with other forms of disconnection.

Previously, the main Upstairs event loop would notice the timeout, then tell the client task to stop; this was a roundabout way of doing things led to stuff like the panic seen in #1103.

For symmetry, we also move the ping task into the client IO task, since there's no reason to bother the main event loop about it: we always want to be pinging periodically, as long as the client IO task is running.

@mkeeter mkeeter requested a review from leftwo January 24, 2024 18:31
mut fr: FramedRead<R, crucible_protocol::CrucibleDecoder>,
mut fw: FramedWrite<W, crucible_protocol::CrucibleEncoder>,
log: &Logger,
log: Logger,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Github is butchering the diff here, sorry about that!

I moved the code from within the tokio::spawn into a separate function named rx_loop, which now includes the timeout as well as reading from the FramedRead (so it's got a select! in there)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yeah, thanks for the comment otherwise I would have puzzled about this for a while.

Copy link
Contributor

@leftwo leftwo left a comment

Choose a reason for hiding this comment

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

Yeah, inside the client task is the right place for this stuff.

mut fr: FramedRead<R, crucible_protocol::CrucibleDecoder>,
mut fw: FramedWrite<W, crucible_protocol::CrucibleEncoder>,
log: &Logger,
log: Logger,
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yeah, thanks for the comment otherwise I would have puzzled about this for a while.

@mkeeter mkeeter merged commit da60a6d into oxidecomputer:main Jan 24, 2024
18 checks passed
@mkeeter mkeeter deleted the timeout-in-client-task branch January 24, 2024 19:53
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.

2 participants