Remove trust-dns when target_os is Android

This commit is contained in:
Sean McArthur
2019-01-10 12:46:44 -08:00
parent b71787be86
commit 2649f9ab56
4 changed files with 22 additions and 1 deletions

View File

@@ -13,10 +13,14 @@ use bytes::BufMut;
use std::io;
use std::sync::Arc;
#[cfg(not(target_os = "android"))]
use dns::TrustDnsResolver;
use Proxy;
#[cfg(not(target_os = "android"))]
type HttpConnector = ::hyper::client::HttpConnector<TrustDnsResolver>;
#[cfg(target_os = "android")]
type HttpConnector = ::hyper::client::HttpConnector;
pub(crate) struct Connector {
@@ -70,12 +74,18 @@ impl Connector {
}
}
#[cfg(not(target_os = "android"))]
fn http_connector() -> ::Result<HttpConnector> {
TrustDnsResolver::new()
.map(HttpConnector::new_with_resolver)
.map_err(::error::dns_system_conf)
}
#[cfg(target_os = "android")]
fn http_connector() -> ::Result<HttpConnector> {
Ok(HttpConnector::new(4))
}
impl Connect for Connector {
type Transport = Conn;
type Error = io::Error;

View File

@@ -196,6 +196,7 @@ extern crate serde_urlencoded;
extern crate tokio;
#[cfg_attr(feature = "default-tls", macro_use)]
extern crate tokio_io;
#[cfg(not(target_os = "android"))]
extern crate trust_dns_resolver;
extern crate url;
extern crate uuid;
@@ -237,6 +238,7 @@ mod connect;
mod connect_async;
mod body;
mod client;
#[cfg(not(target_os = "android"))]
mod dns;
mod into_url;
mod proxy;