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

feat: Add Status constructors #137

Merged
merged 4 commits into from
Nov 15, 2019
Merged

Conversation

alce
Copy link
Collaborator

@alce alce commented Nov 13, 2019

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.

Add convenience constructors for all Status codes and document all
Code variants.

Implement From tokio::timer::timeout::Elapsed for Status
@alce alce changed the title feat(tonic): Add Status constructors and From Elapsed impl feat(tonic): Add Status constructors Nov 13, 2019
@@ -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
Copy link
Member

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?

tonic/src/status.rs Outdated Show resolved Hide resolved
Copy link
Member

@LucioFranco LucioFranco left a 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!

@LucioFranco
Copy link
Member

@alce I think not having the elasped one is fine for now.

@LucioFranco LucioFranco changed the title feat(tonic): Add Status constructors feat: Add Status constructors Nov 15, 2019
@LucioFranco LucioFranco merged commit 997241c into hyperium:master Nov 15, 2019
@alce alce deleted the status-revamp branch November 15, 2019 14:20
rabbitinspace pushed a commit to satelit-project/tonic that referenced this pull request Jan 1, 2020
brentalanmiller pushed a commit to brentalanmiller/tonic that referenced this pull request Oct 6, 2023
* 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
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