Commit Graph
223 Commits
Author SHA1 Message Date
dafea9adee fix(transport): return Poll::ready until error is consumed (#536)
* 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]>
2021-01-15 12:34:41 -05:00
CameronandGitHub 31936e0513 feat(transport): add max http2 frame size to server. (#529)
* 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
2021-01-15 12:00:01 -05:00
Lucio FrancoandGitHub 41c51f1c61 feat(transport): Fix TLS accept w/ peer certs (#535)
* feat(transport): Fix TLS accept w/ peer certs

* fix unused var

* fix feature flag imports

* spawn accept task
2021-01-15 11:59:26 -05:00
fdda5ae26a Upgrade to Tokio 1.0.0 ecosystem (#530)
* 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]>
2021-01-11 12:18:34 -05:00
Alex PearsonandGitHub fe4d5b9d9a fix: gracefully handle bad native certs (#520)
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/4

Fixes: #519
2021-01-07 10:52:13 -05:00
CameronandGitHub a6be8363ed Add h2 error conversion for Status (#509) 2021-01-05 16:04:15 -05:00
CameronandGitHub 6622bb1449 Update tonic logo (#508)
* Use fancy new logo

* Remove shell.nix
2021-01-05 16:03:33 -05:00
Julian PopescuandGitHub fc86563b36 feat(tonic): implement From<io::Error> for Status (#500)
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`
2021-01-05 16:00:08 -05:00
Koki KatoandGitHub e7be352132 transport: impl Service for Channel instead of GrpcService (#482)
* 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
2021-01-05 13:36:18 -05:00
Pedro CaladoandGitHub 2b9cdb9779 feat(transport): expose HTTP2 server keepalive interval and timeout (#486)
Adds two methods to `transport::server::Server` for setting HTTP2 server
keepalive interval and timeout as exposed by `hyper::server::Builder`.

Fixes #474
2021-01-05 13:35:45 -05:00
Jake GouldingandGitHub f58fcf31d1 Merge trailer and inital headers into status on err (#510)
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",
    },
}
```
2020-12-14 14:20:15 -05:00
Luca PalmieriandGitHub 2e964c78c6 feat(transport): Connect lazily in the load balanced channel (#493) 2020-11-18 14:26:49 -05:00
Juan AlvarezandGitHub f1275b611e chore: fix warnings in metadata module (#468) 2020-10-08 09:00:10 -05:00
Juan AlvarezandGitHub 0c69c378fd chore: clippy lints (#467)
* chore: clippy lints
2020-09-29 14:38:49 -05:00
Juan AlvarezandGitHub d4899df832 feat(transport): add user-agent header to client requests. (#457)
* Add a default user-agent header to outgoing requests.
* The user agent can be configured through the `Channel` builder.

fixes #453
2020-09-23 18:58:03 -05:00
Juan AlvarezandGitHub e9910d10a7 fix(transport): reconnect lazy connections after first failure (#458)
* 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
2020-09-23 09:35:42 -05:00
c7fd9d4586 chore(docs): Fix ClientTlsConfig::domain_name docs (#449)
Co-authored-by: Eric Lin <[email protected]>
2020-09-07 10:56:50 -05:00
Juan AlvarezandGitHub 26ce9d12bf fix(transport) Do not panic when building and Endpoint with an invali… (#438)
BREAKING CHANGE: `TryFrom` API has been changed.
2020-08-31 10:02:40 -04:00
594a542b8a fix(transport): Add content-type for Unimplemented (#434)
Co-authored-by: Lucio Franco <[email protected]>
2020-08-21 10:42:41 -04:00
bec4936daf doc(transport): improve connect_with_connector doc (#432)
Co-authored-by: Lucio Franco <[email protected]>
2020-08-20 16:14:35 -04:00
37f6733f85 feat(transport): Add Router::into_service (#419)
Co-authored-by: Danny Hua <[email protected]>
2020-08-20 15:11:31 -04:00
Lucio FrancoandGitHub 90858926b6 chore: Prepare 0.3.1 release (#436) 2020-08-20 10:49:12 -04:00
Lucio FrancoandGitHub 2ea17b2ecf fix(transport): Return connection error on Channel::connect (#413)
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
2020-07-27 12:44:11 -04:00
Harry BarberandGitHub 5bd8a04baf Fix typo (#405) 2020-07-27 12:33:24 -04:00
L1AN0andGitHub 96db606908 Fix typo in doc. (#398) 2020-07-14 16:41:39 -04:00
Lucio FrancoandGitHub 62b8ab0b51 chore: Prepare 0.3.0 release (#399)
* chore: Prepare 0.3.0 release

* update changelog

* fix builds

* Update breaking changes
2020-07-13 13:00:54 -04:00
Kaleb ElwertandGitHub 570c606397 chore: Upgrade base64 and tokio-rustls packages (#397) 2020-07-10 23:10:15 -05:00
Lucio FrancoandGitHub a567f17e52 chore: Prepare 0.2.2 release (#396) 2020-07-10 12:59:22 -04:00
Lucio FrancoandGitHub 2c4c544d90 fix: Status::details leaking base64 encoding (#395)
Fixes #379
2020-07-10 12:40:55 -04:00
Harry BarberandGitHub 2b997b0c5f feat(transport): Add optional service methods (#275) 2020-07-10 12:39:52 -04:00
Lucio FrancoandGitHub 98bcc339b1 Rename get_uri to uri (#393)
* Rename `get_uri` to `uri`

* Fix doc test
2020-07-10 11:45:33 -04:00
Dan BurkertandGitHub ec9046dfc2 feat(transport): Add Endpoint::connect_lazy method (#392)
Fixes #167
2020-07-10 10:46:33 -04:00
Mikail BagishovandGitHub ab1de44771 feat: Add Display implementation for Code (#386) 2020-07-06 14:07:08 -04:00
Sarfaraz NawazandGitHub d68dd36532 feat(codec): Improve compression flag log (#374) 2020-07-06 12:00:48 -04:00
Johan AnderssonandGitHub 3b9d6a6262 fix(transport): Propagate errors in tls_config instead of unwrap/panic (#385)
* Propagate errors in tls_config instead of unwrap

Ran into `tls_connector` failing and causing our app to panic and shutdown as it seems there wasn't any way to avoid panicking in `tls_config`.

So after talking to @LucioFranco briefly `tls_config` now returns a `Result` instead and propagates errors to the caller, where they can be handled.

* Fix compile warning when tls feature is disabled
2020-07-06 09:18:10 -04:00
Kaleb ElwertandGitHub 327b4fffa3 feat: Add Status::to_http (#376) 2020-06-25 13:08:10 -04:00
Sherlock HoloandGitHub 54d7a7af6b feat: add new method get_uri for Endpoint (#371) 2020-06-16 18:22:12 -04:00
CaioandGitHub 761029444f chore: Use new instead of with_rustls (#369) 2020-06-15 12:21:41 -04:00
Taiki EndoandGitHub 5bda615632 fix: Remove uses of pin_project::project attribute (#367)
pin-project will deprecate the project attribute due to some unfixable
limitations.

Refs: https://github.com/taiki-e/pin-project/issues/225
2020-06-09 13:09:35 -04:00
Dawid NowakandGitHub 85ae0a4733 feat(transport): Dynamic load balancing (#341) 2020-05-15 15:03:28 -04:00
Dmitry ShuranovandGitHub 372da52e96 feat: Add metadata to error responses (#348) 2020-05-10 11:46:45 -04:00
Lucio FrancoandGitHub 59ce1d2590 chore: Prepare 0.2.1 release (#346) 2020-05-07 15:46:45 -04:00
Lucio FrancoandGitHub e683ffef1f fix: base64 encode details header (#345) 2020-05-07 15:31:26 -04:00
Spencer JudgeandGitHub 68d2ab3339 Add some info about concurrent usage to client mod (#328) 2020-05-05 13:27:53 -04:00
Johan ThomsenandGitHub 99fbe22e7c fix(transport): Apply tls-connector for discovery when applicable (#334) (#338) 2020-05-05 13:19:04 -04:00
d2ad8df629 feat(transport): Add AsRef impl for Certificate (#326)
Co-authored-by: IvanV <[email protected]>
2020-04-09 13:41:54 -04:00
Lucio FrancoandGitHub 6f378e2bd0 chore: Prepare 0.2 release (#321)
Signed-off-by: Lucio Franco <[email protected]>
2020-04-01 14:34:51 -04:00
Lucio FrancoandGitHub 04a8c0c82a fix(transport): Handle tls accepting on task (#320)
Signed-off-by: Lucio Franco <[email protected]>
2020-04-01 13:02:19 -04:00
Lucio FrancoandGitHub 555323630a chore: Update tokio-util 0.3 (#315)
Signed-off-by: Lucio Franco <[email protected]>
2020-03-31 15:06:52 -04:00
Lucio FrancoandGitHub 3cba9f5f6f chore: Fix feature flags and build docs (#311)
Signed-off-by: Lucio Franco <[email protected]>
2020-03-30 12:02:10 -04:00