* fix(transport): return Poll::ready until error is consumed
When a lazy connection fails to connect it first
returns Poll::ready from the reconnect service,
yet the subsequent call returns Poll::pending
making tower_balance loop forever.
Instead, on error we return Ready
until the error is consumed in the
call method.
* chore: revert version change
* refactor: Into<Error> bounds for error intead of debug
* Remove fmt::Debug bound for reconnect
Co-authored-by: Helge Hoff <[email protected]>
* tonic: add max http2 frame size to server.
Exposes option to configure the max http2 frame size used by the
underlying hyper server via the `tonic::transport::Server` builder.
Refs: #264
* fix http2_* methods broken in merge conflict
* Upgrade Tonic to Tokio 1.0
Work in progress for updating Tonic to Tokio 1.0. Since tower has not
been released to crates.io, a git dependency is taken instead.
* Upgrade Tonic to Tokio 1.0 phase 2
* tonic: remove tower-* deps
* Apply suggestions from code review
Co-authored-by: Ed Marshall <[email protected]>
Co-authored-by: Lucio Franco <[email protected]>
Instead of failing and bailing when a bad cert is found, ignore one-off
errors for bad certs and continue to load the rest of the store.
These one-off errors mostly affect MacOS users, as found in this
rustls-native-certs issue: https://github.com/ctz/rustls-native-certs/issues/4Fixes: #519
Implements the conversion from `std::io::Error` to `tonic::Status`.
**Motivation:** The `io::Error` conversion is currently left as
unimplemented. It either should be implemented or removed if it won't be
implemented.
**Solution:** Implements the conversion from `std::io::Error` to
`tonic::Status`
* transport: impl Service for Channel instead of GrpcService
This adds tower::Service impl for tonic::transport::Channel
and removes GrpcService impl declaration.
Channel still implements GrpcService, thanks to the general
impl declaration of GrpcService for types who implement Service.
Fixes#481.
* examples: stop using GrpcService to avoid ambiguity
* examples: add timeout example
Adds two methods to `transport::server::Server` for setting HTTP2 server
keepalive interval and timeout as exposed by `hyper::server::Builder`.
Fixes#474
The C++ gRPC server sometimes returns both headers and trailers. An
excerpt from Wireshark:
```
Stream: HEADERS, Stream ID: 1, Length 136, 200 OK
Header: :status: 200 OK
Header: x-middleware: expected value
Header: content-type: application/grpc
Header: grpc-accept-encoding: identity,deflate,gzip
Header: accept-encoding: identity,gzip
Stream: HEADERS, Stream ID: 1, Length 92
Header: grpc-status: 2
Header: grpc-message: Unknown
Header: x-arrow-status: 9
Header: x-arrow-status-message-bin: VW5rbm93bg
```
Before this commit, only the metadata from the trailer would be
available, missing the `x-middleware` header:
```
MetadataMap {
headers: {
"x-arrow-status-message-bin": "VW5rbm93bg",
"x-arrow-status": "9",
},
}
```
* fix(transport): reconnect lazy connections after first failure
Channels created with lazy connections never try to reconnect if the
first connection attempt fails. This is because `Reconnect` returns
`Poll::Ready(Err)` on poll_ready and the service is considered dead.
This change passes a flag to Reconnect to signal if the connection
is intended to be lazy, in which case reconnect returns the error on
the next call.
fixes#452
Before this fix, if the connect phase of the transport failed before
ever establishing a connection, we would never return the error until
the first call to send a request. This PR changes that behavior to only
forward the error to the call method if we have ever made a connection
before. If we have never established a connection before then
`Reconnect` will return an error on the call to `poll_ready`.
Fixes#403
* examples: update to `tracing` 0.1.14, use `#[instrument]`
Now that `tracing-attributes`'s `#[instrument]` macro plays nicely with
`async-trait`, we can update the tracing example to use `instrument`.
This lets us simplify the events emitted in the example.
Signed-off-by: Eliza Weisman <[email protected]>
* feat(transport): Dynamic load balancing (#341)
* Fix typo (#356)
Co-authored-by: Dawid Nowak <[email protected]>
Co-authored-by: Paulo Duarte <[email protected]>