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
When calling methods on Arc<MyService> where the method is also defined on Arc (e.g. drop and clone), calling inner.#method_ident(request) will actually attempt to call the Arc method instead of the method on the service, resulting in a compile error. This change removes the ambiguity by dereferencing the inner Arc.
* don't replace extern_path'd paths
tonic-build will replace all paths except for google well known types
with one rooted at the super module. For paths that have already been
replaced with a fully qualified path via the extern_path config option,
(e.g. "::uuid::Uuid"), this results in an invalid path
(e.g. "super::::uuid::Uuid"), and a build failure. These paths should
also be excluded when prefixing relative modules with super.
* add doc in tonic-build clarifying extern_path
extern_path expects fully qualified proto and rust paths
* add test cast case for extern path fix
add a test that extern path does indeed result in service types using
the specified type from an external crate. we test this by creating a
service type that has a proto from a different crate, and asserting that
it does indeed impl a trait from that crate
* add license/publish to extern_path test crates
* fix(build): Prevent duplicated client/server generated code
The tonic-build process collects up RPC services as they are provided by
prost, before writing them out as part of the finalization step for a
given protocol buffer package.
In the case of imported protocol buffer packages, there may be RPC
services included by import in addition to those in the top-level
package. Therefore it is necessary to make sure each set of
client/server services gathered by tonic-build is cleared after the
finalization process for a given protocol buffer package, otherwise they
will be incorrectly aggregated as the generation process proceeds
through the subsequent packages.
* Test case for duplicated client/server generated code
A simple test case that will fail to build without a fix to prevent
RPC services being duplicated into inappropriate modules (that related
to particular protocol buffer packages).
* Additional test case for included_service
Introduces an additional case that captures making sure services defined
before including a package with additional services doesn't
incidentially clear such precursor services from the including package.
* Fix unnecessary newline to keep `cargo fmt` happy