Use JoinSet for resolver tokio tasks
This commit is contained in:
@@ -123,7 +123,7 @@ impl TokioAsyncResolver {
|
||||
/// documentation for `AsyncResolver` for more information on how to use
|
||||
/// the background future.
|
||||
pub fn tokio(config: ResolverConfig, options: ResolverOpts) -> Result<Self, ResolveError> {
|
||||
Self::new(config, options, TokioHandle)
|
||||
Self::new(config, options, TokioHandle::default())
|
||||
}
|
||||
|
||||
/// Constructs a new Tokio based Resolver with the system configuration.
|
||||
@@ -136,7 +136,7 @@ impl TokioAsyncResolver {
|
||||
doc(cfg(all(feature = "system-config", any(unix, target_os = "windows"))))
|
||||
)]
|
||||
pub fn tokio_from_system_conf() -> Result<Self, ResolveError> {
|
||||
Self::from_system_conf(TokioHandle)
|
||||
Self::from_system_conf(TokioHandle::default())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1143,7 +1143,7 @@ mod tests {
|
||||
fn test_lookup_google() {
|
||||
use super::testing::lookup_test;
|
||||
let io_loop = Runtime::new().expect("failed to create tokio runtime");
|
||||
let handle = TokioHandle;
|
||||
let handle = TokioHandle::default();
|
||||
lookup_test::<Runtime, TokioRuntime>(ResolverConfig::google(), io_loop, handle)
|
||||
}
|
||||
|
||||
@@ -1151,7 +1151,7 @@ mod tests {
|
||||
fn test_lookup_cloudflare() {
|
||||
use super::testing::lookup_test;
|
||||
let io_loop = Runtime::new().expect("failed to create tokio runtime");
|
||||
let handle = TokioHandle;
|
||||
let handle = TokioHandle::default();
|
||||
lookup_test::<Runtime, TokioRuntime>(ResolverConfig::cloudflare(), io_loop, handle)
|
||||
}
|
||||
|
||||
@@ -1159,7 +1159,7 @@ mod tests {
|
||||
fn test_lookup_quad9() {
|
||||
use super::testing::lookup_test;
|
||||
let io_loop = Runtime::new().expect("failed to create tokio runtime");
|
||||
let handle = TokioHandle;
|
||||
let handle = TokioHandle::default();
|
||||
lookup_test::<Runtime, TokioRuntime>(ResolverConfig::quad9(), io_loop, handle)
|
||||
}
|
||||
|
||||
@@ -1167,7 +1167,7 @@ mod tests {
|
||||
fn test_ip_lookup() {
|
||||
use super::testing::ip_lookup_test;
|
||||
let io_loop = Runtime::new().expect("failed to create tokio runtime");
|
||||
let handle = TokioHandle;
|
||||
let handle = TokioHandle::default();
|
||||
ip_lookup_test::<Runtime, TokioRuntime>(io_loop, handle)
|
||||
}
|
||||
|
||||
@@ -1175,7 +1175,7 @@ mod tests {
|
||||
fn test_ip_lookup_across_threads() {
|
||||
use super::testing::ip_lookup_across_threads_test;
|
||||
let _io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
|
||||
let handle = TokioHandle;
|
||||
let handle = TokioHandle::default();
|
||||
ip_lookup_across_threads_test::<Runtime, TokioRuntime>(handle)
|
||||
}
|
||||
|
||||
@@ -1184,7 +1184,7 @@ mod tests {
|
||||
fn test_sec_lookup() {
|
||||
use super::testing::sec_lookup_test;
|
||||
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
|
||||
let handle = TokioHandle;
|
||||
let handle = TokioHandle::default();
|
||||
sec_lookup_test::<Runtime, TokioRuntime>(io_loop, handle);
|
||||
}
|
||||
|
||||
@@ -1193,7 +1193,7 @@ mod tests {
|
||||
fn test_sec_lookup_fails() {
|
||||
use super::testing::sec_lookup_fails_test;
|
||||
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
|
||||
let handle = TokioHandle;
|
||||
let handle = TokioHandle::default();
|
||||
sec_lookup_fails_test::<Runtime, TokioRuntime>(io_loop, handle);
|
||||
}
|
||||
|
||||
@@ -1204,7 +1204,7 @@ mod tests {
|
||||
fn test_system_lookup() {
|
||||
use super::testing::system_lookup_test;
|
||||
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
|
||||
let handle = TokioHandle;
|
||||
let handle = TokioHandle::default();
|
||||
system_lookup_test::<Runtime, TokioRuntime>(io_loop, handle);
|
||||
}
|
||||
|
||||
@@ -1215,7 +1215,7 @@ mod tests {
|
||||
fn test_hosts_lookup() {
|
||||
use super::testing::hosts_lookup_test;
|
||||
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
|
||||
let handle = TokioHandle;
|
||||
let handle = TokioHandle::default();
|
||||
hosts_lookup_test::<Runtime, TokioRuntime>(io_loop, handle);
|
||||
}
|
||||
|
||||
@@ -1223,7 +1223,7 @@ mod tests {
|
||||
fn test_fqdn() {
|
||||
use super::testing::fqdn_test;
|
||||
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
|
||||
let handle = TokioHandle;
|
||||
let handle = TokioHandle::default();
|
||||
fqdn_test::<Runtime, TokioRuntime>(io_loop, handle);
|
||||
}
|
||||
|
||||
@@ -1231,7 +1231,7 @@ mod tests {
|
||||
fn test_ndots() {
|
||||
use super::testing::ndots_test;
|
||||
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
|
||||
let handle = TokioHandle;
|
||||
let handle = TokioHandle::default();
|
||||
ndots_test::<Runtime, TokioRuntime>(io_loop, handle);
|
||||
}
|
||||
|
||||
@@ -1239,7 +1239,7 @@ mod tests {
|
||||
fn test_large_ndots() {
|
||||
use super::testing::large_ndots_test;
|
||||
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
|
||||
let handle = TokioHandle;
|
||||
let handle = TokioHandle::default();
|
||||
large_ndots_test::<Runtime, TokioRuntime>(io_loop, handle);
|
||||
}
|
||||
|
||||
@@ -1247,7 +1247,7 @@ mod tests {
|
||||
fn test_domain_search() {
|
||||
use super::testing::domain_search_test;
|
||||
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
|
||||
let handle = TokioHandle;
|
||||
let handle = TokioHandle::default();
|
||||
domain_search_test::<Runtime, TokioRuntime>(io_loop, handle);
|
||||
}
|
||||
|
||||
@@ -1255,7 +1255,7 @@ mod tests {
|
||||
fn test_search_list() {
|
||||
use super::testing::search_list_test;
|
||||
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
|
||||
let handle = TokioHandle;
|
||||
let handle = TokioHandle::default();
|
||||
search_list_test::<Runtime, TokioRuntime>(io_loop, handle);
|
||||
}
|
||||
|
||||
@@ -1263,7 +1263,7 @@ mod tests {
|
||||
fn test_idna() {
|
||||
use super::testing::idna_test;
|
||||
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
|
||||
let handle = TokioHandle;
|
||||
let handle = TokioHandle::default();
|
||||
idna_test::<Runtime, TokioRuntime>(io_loop, handle);
|
||||
}
|
||||
|
||||
@@ -1271,7 +1271,7 @@ mod tests {
|
||||
fn test_localhost_ipv4() {
|
||||
use super::testing::localhost_ipv4_test;
|
||||
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
|
||||
let handle = TokioHandle;
|
||||
let handle = TokioHandle::default();
|
||||
localhost_ipv4_test::<Runtime, TokioRuntime>(io_loop, handle);
|
||||
}
|
||||
|
||||
@@ -1279,7 +1279,7 @@ mod tests {
|
||||
fn test_localhost_ipv6() {
|
||||
use super::testing::localhost_ipv6_test;
|
||||
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
|
||||
let handle = TokioHandle;
|
||||
let handle = TokioHandle::default();
|
||||
localhost_ipv6_test::<Runtime, TokioRuntime>(io_loop, handle);
|
||||
}
|
||||
|
||||
@@ -1287,7 +1287,7 @@ mod tests {
|
||||
fn test_search_ipv4_large_ndots() {
|
||||
use super::testing::search_ipv4_large_ndots_test;
|
||||
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
|
||||
let handle = TokioHandle;
|
||||
let handle = TokioHandle::default();
|
||||
search_ipv4_large_ndots_test::<Runtime, TokioRuntime>(io_loop, handle);
|
||||
}
|
||||
|
||||
@@ -1295,7 +1295,7 @@ mod tests {
|
||||
fn test_search_ipv6_large_ndots() {
|
||||
use super::testing::search_ipv6_large_ndots_test;
|
||||
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
|
||||
let handle = TokioHandle;
|
||||
let handle = TokioHandle::default();
|
||||
search_ipv6_large_ndots_test::<Runtime, TokioRuntime>(io_loop, handle);
|
||||
}
|
||||
|
||||
@@ -1303,13 +1303,13 @@ mod tests {
|
||||
fn test_search_ipv6_name_parse_fails() {
|
||||
use super::testing::search_ipv6_name_parse_fails_test;
|
||||
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
|
||||
let handle = TokioHandle;
|
||||
let handle = TokioHandle::default();
|
||||
search_ipv6_name_parse_fails_test::<Runtime, TokioRuntime>(io_loop, handle);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_build_names_onion() {
|
||||
let handle = TokioHandle;
|
||||
let handle = TokioHandle::default();
|
||||
let mut config = ResolverConfig::default();
|
||||
config.add_search(Name::from_ascii("example.com.").unwrap());
|
||||
let resolver =
|
||||
|
Reference in New Issue
Block a user