fix(tonic): change connect_lazy to be infallible (#712)

Co-authored-by: Lucio Franco <[email protected]>
This commit is contained in:
Nisheeth Barthwal
2021-10-20 10:47:17 -04:00
committed by GitHub
co-authored by Lucio Franco
parent 53ecc1f85e
commit 2e471548d8
3 changed files with 4 additions and 7 deletions
-1
View File
@@ -57,7 +57,6 @@ This release includes a new crate `tonic-web` which is versioned at `0.1` and su
* **transport:** provide generic access to connect info ([#647](https://github.com/hyperium/tonic/issues/647)) ([e5e3118](https://github.com/hyperium/tonic/commit/e5e311853bff347355722bc829d40f54e8954aee)) * **transport:** provide generic access to connect info ([#647](https://github.com/hyperium/tonic/issues/647)) ([e5e3118](https://github.com/hyperium/tonic/commit/e5e311853bff347355722bc829d40f54e8954aee))
# [0.4.3](https://github.com/hyperium/tonic/compare/v0.4.2...v0.4.3) (2021-04-29) # [0.4.3](https://github.com/hyperium/tonic/compare/v0.4.2...v0.4.3) (2021-04-29)
### Features ### Features
+1 -3
View File
@@ -63,9 +63,7 @@ async fn connect_lazy_reconnects_after_first_failure() {
let sender = Arc::new(Mutex::new(Some(tx))); let sender = Arc::new(Mutex::new(Some(tx)));
let svc = test_server::TestServer::new(Svc(sender)); let svc = test_server::TestServer::new(Svc(sender));
let channel = Endpoint::from_static("http://127.0.0.1:1339") let channel = Endpoint::from_static("http://127.0.0.1:1339").connect_lazy();
.connect_lazy()
.unwrap();
let mut client = TestClient::new(channel); let mut client = TestClient::new(channel);
+3 -3
View File
@@ -284,7 +284,7 @@ impl Endpoint {
/// ///
/// The channel returned by this method does not attempt to connect to the endpoint until first /// The channel returned by this method does not attempt to connect to the endpoint until first
/// use. /// use.
pub fn connect_lazy(&self) -> Result<Channel, Error> { pub fn connect_lazy(&self) -> Channel {
let mut http = hyper::client::connect::HttpConnector::new(); let mut http = hyper::client::connect::HttpConnector::new();
http.enforce_http(false); http.enforce_http(false);
http.set_nodelay(self.tcp_nodelay); http.set_nodelay(self.tcp_nodelay);
@@ -299,9 +299,9 @@ impl Endpoint {
if let Some(connect_timeout) = self.connect_timeout { if let Some(connect_timeout) = self.connect_timeout {
let mut connector = hyper_timeout::TimeoutConnector::new(connector); let mut connector = hyper_timeout::TimeoutConnector::new(connector);
connector.set_connect_timeout(Some(connect_timeout)); connector.set_connect_timeout(Some(connect_timeout));
Ok(Channel::new(connector, self.clone())) Channel::new(connector, self.clone())
} else { } else {
Ok(Channel::new(connector, self.clone())) Channel::new(connector, self.clone())
} }
} }