From 2b5270f087884fedef72414705d46f7ee27f2875 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Tue, 25 Sep 2018 03:16:03 -0400 Subject: [PATCH] Clone static HttpConnector --- src/http.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/http.rs b/src/http.rs index 987b871874a3ad..0967bf3dd29f0f 100644 --- a/src/http.rs +++ b/src/http.rs @@ -10,22 +10,19 @@ use hyper::client::Client; use hyper::client::HttpConnector; use hyper::Uri; use hyper_rustls; -use std::sync::Mutex; -type HttpsConnector = hyper_rustls::HttpsConnector; +type Connector = hyper_rustls::HttpsConnector; lazy_static! { - static ref connector_mutex: Mutex = { - let num_dns_threads = 0; - Mutex::new(hyper_rustls::HttpsConnector::new(num_dns_threads)) + static ref connector: Connector = { + let num_dns_threads = 4; }; } -pub fn get_client() -> Client { +pub fn get_client() -> Client { // TODO use Hyper's connection pool. - //let connector = connector_mutex.lock().unwrap(); - let connector: HttpsConnector = hyper_rustls::HttpsConnector::new(4); - let client = Client::builder().build(connector); + let c = Connector::new(num_dns_threads); + let client = Client::builder().build(c); return client; }