diff --git a/c-ares-sys/c-ares b/c-ares-sys/c-ares index 5c739798e..1f76ff8ed 160000 --- a/c-ares-sys/c-ares +++ b/c-ares-sys/c-ares @@ -1 +1 @@ -Subproject commit 5c739798eb5b46d2306d638287c671111b74eb91 +Subproject commit 1f76ff8ed84e0bf3108a12630ed41ee2d50a643f diff --git a/c-ares-sys/ffi.patch b/c-ares-sys/ffi.patch index c52378d35..40d62ff04 100644 --- a/c-ares-sys/ffi.patch +++ b/c-ares-sys/ffi.patch @@ -1,7 +1,7 @@ ---- src/ffi.rs.orig 2023-05-04 16:08:51.671439524 +0100 -+++ src/ffi.rs 2023-05-04 16:11:25.431331417 +0100 +--- src/ffi.rs.orig 2023-10-06 21:01:06.294030877 +0100 ++++ src/ffi.rs 2023-10-06 21:01:20.774032176 +0100 @@ -1,13 +1,23 @@ - /* automatically generated by rust-bindgen 0.65.1 */ + /* automatically generated by rust-bindgen 0.68.1 */ +#![allow(non_camel_case_types, non_snake_case)] +use c_types::fd_set; +use c_types::hostent; @@ -30,7 +30,7 @@ pub type ares_sock_state_cb = ::std::option::Option< unsafe extern "C" fn( data: *mut ::std::os::raw::c_void, -@@ -694,3 +704,17 @@ +@@ -695,3 +705,17 @@ dst: *mut ::std::os::raw::c_void, ) -> ::std::os::raw::c_int; } diff --git a/c-ares-sys/src/constants.rs b/c-ares-sys/src/constants.rs index 53197f5d3..d0543024e 100644 --- a/c-ares-sys/src/constants.rs +++ b/c-ares-sys/src/constants.rs @@ -65,6 +65,7 @@ pub const ARES_OPT_EDNSPSZ: c_int = 1 << 15; pub const ARES_OPT_NOROTATE: c_int = 1 << 16; pub const ARES_OPT_RESOLVCONF: c_int = 1 << 17; pub const ARES_OPT_HOSTS_FILE: c_int = 1 << 18; +pub const ARES_OPT_UDP_MAX_QUERIES: c_int = 1 << 19; // Flags for nameinfo queries pub const ARES_NI_NOFQDN: c_int = 1; diff --git a/c-ares-sys/src/ffi.rs b/c-ares-sys/src/ffi.rs index eb88c30dd..da115c2dc 100644 --- a/c-ares-sys/src/ffi.rs +++ b/c-ares-sys/src/ffi.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.65.1 */ +/* automatically generated by rust-bindgen 0.68.1 */ #![allow(non_camel_case_types, non_snake_case)] use c_types::fd_set; use c_types::hostent; @@ -54,6 +54,7 @@ pub struct ares_options { pub ednspsz: ::std::os::raw::c_int, pub resolvconf_path: *mut ::std::os::raw::c_char, pub hosts_path: *mut ::std::os::raw::c_char, + pub udp_max_queries: ::std::os::raw::c_int, } #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/src/channel.rs b/src/channel.rs index b1a57a15b..155081e94 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -77,7 +77,7 @@ impl Options { /// Set the number of milliseconds each name server is given to respond to a query on the first /// try. (After the first try, the timeout algorithm becomes more complicated, but scales - /// linearly with the value of timeout). The default is 5000ms. + /// linearly with the value of timeout). The default is 2000ms. pub fn set_timeout(&mut self, ms: u32) -> &mut Self { self.ares_options.timeout = ms as c_int; self.optmask |= c_ares_sys::ARES_OPT_TIMEOUTMS; @@ -85,7 +85,7 @@ impl Options { } /// Set the number of tries the resolver will try contacting each name server before giving up. - /// The default is four tries. + /// The default is three tries. pub fn set_tries(&mut self, tries: u32) -> &mut Self { self.ares_options.tries = tries as c_int; self.optmask |= c_ares_sys::ARES_OPT_TRIES; @@ -153,6 +153,15 @@ impl Options { self } + /// The maximum number of udp queries that can be sent on a single ephermeral port to a given + /// DNS server before a new ephemeral port is assigned. Any value of 0 or less will be + /// considered unlimited, and is the default. + pub fn set_udp_max_queries(&mut self, udp_max_queries: i32) -> &mut Self { + self.ares_options.udp_max_queries = udp_max_queries; + self.optmask |= c_ares_sys::ARES_OPT_UDP_MAX_QUERIES; + self + } + /// Set the callback function to be invoked when a socket changes state. /// /// `callback(socket, read, write)` will be called when a socket changes state: