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

chore(tonic): Move TimeoutExpired out of transport #1826

Merged
merged 1 commit into from
Jul 28, 2024

Conversation

FrankReh
Copy link
Contributor

By moving the TimeoutExpired type from the transport module to the the tonic engine proper, the type is made available to other transport implementations and tonic can be built without the "server" feature while still returning a Status indicating the timeout.

Alternative transport implementations can use the type, now that it is moved, when they want the tonic Status error handling to recognize the error as having been triggered by a timeout in the transport logic. The tonic Status error will have a code of Cancelled with a message of "Timeout expired".

There is already a test for this:

cargo test picks_server_timeout_if_thats_sorter

which worked the original way and contines to work; but now a new transport implementation can get the same behavior.

Addresses #1825.

By moving the TimeoutExpired type from the transport module
to the the tonic engine proper, the type is made available to
other transport implementations and tonic can be built without
the "server" feature while still returning a Status indicating
the timeout.

Alternative transport implementations can use the type, now that it is
moved, when they want the tonic Status error handling to recognize the
error as having been triggered by a timeout in the transport logic. The
tonic Status error will have a code of Cancelled with a message of
"Timeout expired".

There is already a test for this:

    cargo test picks_server_timeout_if_thats_sorter

which worked the original way and contines to work; but now a new
transport implementation can get the same behavior.

Addresses hyperium#1825.
Copy link
Contributor

@djc djc left a comment

Choose a reason for hiding this comment

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

Makes sense, thanks!

@djc djc added this pull request to the merge queue Jul 28, 2024
Merged via the queue into hyperium:master with commit 71fca36 Jul 28, 2024
16 checks passed
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