Skip to content

Commit

Permalink
fix(transport): Apply tls-connector for discovery when applicable (#334
Browse files Browse the repository at this point in the history
…) (#338)
  • Loading branch information
johanot authored May 5, 2020
1 parent 59c4555 commit 99fbe22
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tonic/src/transport/service/discover.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use super::super::service;
use super::connection::Connection;
use crate::transport::Endpoint;
use std::{
Expand Down Expand Up @@ -52,8 +53,15 @@ impl Discover for ServiceList {
let mut http = hyper::client::connect::HttpConnector::new();
http.set_nodelay(endpoint.tcp_nodelay);
http.set_keepalive(endpoint.tcp_keepalive);
http.enforce_http(false);

let fut = Connection::new(http, endpoint);
#[cfg(feature = "tls")]
let connector = service::connector(http, endpoint.tls.clone());

#[cfg(not(feature = "tls"))]
let connector = service::connector(http);

let fut = Connection::new(connector, endpoint);
self.connecting = Some(Box::pin(fut));
} else {
return Poll::Pending;
Expand Down

0 comments on commit 99fbe22

Please sign in to comment.