-
Notifications
You must be signed in to change notification settings - Fork 1k
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: Add Status
constructors
#137
Conversation
Add convenience constructors for all Status codes and document all Code variants. Implement From tokio::timer::timeout::Elapsed for Status
tonic/src/status.rs
Outdated
@@ -8,7 +8,19 @@ const GRPC_STATUS_HEADER_CODE: &str = "grpc-status"; | |||
const GRPC_STATUS_MESSAGE_HEADER: &str = "grpc-message"; | |||
const GRPC_STATUS_DETAILS_HEADER: &str = "grpc-status-details-bin"; | |||
|
|||
// Standard status codes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fantastic!! Few comments but otherwise I think this is ready!
@alce I think not having the elasped one is fine for now. |
Co-Authored-By: Lucio Franco <[email protected]>
Status
constructors
Co-Authored-By: Lucio Franco <[email protected]>
* deps: update to rustls 0.21.0. This commit updates tokio-rustls to use the freshly released Rustls 0.21.0 release tag, and the rustls-webpki fork of webpki. * tests: improve server wait in early data test. Previously the `test_0rtt` test had a hardcoded 1s sleep waiting for an `openssl s_server` process to become ready. If 1s waiting wasn't long enough, the test could fail with an error like: ``` Error: Os { code: 10061, kind: ConnectionRefused, message: "No connection could be made because the target machine actively refused it." } ``` This commit replaces the hardcoded sleep with a sleep loop that gradually increases the delay time up to a fixed maximum. This makes the test run faster when the server is ready quickly and prevents an error if it takes longer than 1s to stabilize. * version: 0.23.4 -> 0.24.0
This patch adds shortcut constructors for all Status codes as well as documentation for all Code variants.
From<tokio::timer::timeout::Elapsed>
for Status is also implemented, which is useful for the in-progress revamp of request timeouts.Edit: the
From<Elapsed> for Status
does not compile when the transport feature is disabled. Without it, there is no tokio available. I removed the implementation for now.