make it no mut
This commit is contained in:
@@ -29,7 +29,7 @@ impl<C: ClientHandle + Unpin> DnsHandle for MutMessageHandle<C> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused_mut)]
|
#[allow(unused_mut)]
|
||||||
fn send<R: Into<DnsRequest> + Unpin>(&mut self, request: R) -> Self::Response {
|
fn send<R: Into<DnsRequest> + Unpin>(&self, request: R) -> Self::Response {
|
||||||
let mut request = request.into();
|
let mut request = request.into();
|
||||||
|
|
||||||
#[cfg(feature = "dnssec")]
|
#[cfg(feature = "dnssec")]
|
||||||
|
@@ -147,7 +147,7 @@ impl DnsHandle for AsyncClient {
|
|||||||
type Response = DnsExchangeSend;
|
type Response = DnsExchangeSend;
|
||||||
type Error = ProtoError;
|
type Error = ProtoError;
|
||||||
|
|
||||||
fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(&mut self, request: R) -> Self::Response {
|
fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(&self, request: R) -> Self::Response {
|
||||||
self.exchange.send(request)
|
self.exchange.send(request)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -71,7 +71,7 @@ impl DnsHandle for AsyncDnssecClient {
|
|||||||
type Response = Pin<Box<(dyn Stream<Item = Result<DnsResponse, ProtoError>> + Send + 'static)>>;
|
type Response = Pin<Box<(dyn Stream<Item = Result<DnsResponse, ProtoError>> + Send + 'static)>>;
|
||||||
type Error = ProtoError;
|
type Error = ProtoError;
|
||||||
|
|
||||||
fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(&mut self, request: R) -> Self::Response {
|
fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(&self, request: R) -> Self::Response {
|
||||||
self.client.send(request)
|
self.client.send(request)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -99,7 +99,7 @@ pub trait Client {
|
|||||||
&self,
|
&self,
|
||||||
msg: R,
|
msg: R,
|
||||||
) -> Vec<ClientResult<DnsResponse>> {
|
) -> Vec<ClientResult<DnsResponse>> {
|
||||||
let (mut client, runtime) = match self.spawn_client() {
|
let (client, runtime) = match self.spawn_client() {
|
||||||
Ok(c_r) => c_r,
|
Ok(c_r) => c_r,
|
||||||
Err(e) => return vec![Err(e)],
|
Err(e) => return vec![Err(e)],
|
||||||
};
|
};
|
||||||
|
@@ -48,7 +48,7 @@ where
|
|||||||
async fn inner_send(
|
async fn inner_send(
|
||||||
request: DnsRequest,
|
request: DnsRequest,
|
||||||
active_queries: Arc<Mutex<HashMap<Query, RcStream<<H as DnsHandle>::Response>>>>,
|
active_queries: Arc<Mutex<HashMap<Query, RcStream<<H as DnsHandle>::Response>>>>,
|
||||||
mut client: H,
|
client: H,
|
||||||
) -> impl Stream<Item = Result<DnsResponse, ProtoError>> {
|
) -> impl Stream<Item = Result<DnsResponse, ProtoError>> {
|
||||||
// TODO: what if we want to support multiple queries (non-standard)?
|
// TODO: what if we want to support multiple queries (non-standard)?
|
||||||
let query = request.queries().first().expect("no query!").clone();
|
let query = request.queries().first().expect("no query!").clone();
|
||||||
@@ -77,7 +77,7 @@ where
|
|||||||
type Response = Pin<Box<dyn Stream<Item = Result<DnsResponse, ProtoError>> + Send>>;
|
type Response = Pin<Box<dyn Stream<Item = Result<DnsResponse, ProtoError>> + Send>>;
|
||||||
type Error = ProtoError;
|
type Error = ProtoError;
|
||||||
|
|
||||||
fn send<R: Into<DnsRequest>>(&mut self, request: R) -> Self::Response {
|
fn send<R: Into<DnsRequest>>(&self, request: R) -> Self::Response {
|
||||||
let request = request.into();
|
let request = request.into();
|
||||||
|
|
||||||
Box::pin(
|
Box::pin(
|
||||||
@@ -119,7 +119,7 @@ mod test {
|
|||||||
type Response = Pin<Box<dyn Stream<Item = Result<DnsResponse, ProtoError>> + Send>>;
|
type Response = Pin<Box<dyn Stream<Item = Result<DnsResponse, ProtoError>> + Send>>;
|
||||||
type Error = ProtoError;
|
type Error = ProtoError;
|
||||||
|
|
||||||
fn send<R: Into<DnsRequest> + Send + 'static>(&mut self, request: R) -> Self::Response {
|
fn send<R: Into<DnsRequest> + Send + 'static>(&self, request: R) -> Self::Response {
|
||||||
let i = Arc::clone(&self.i);
|
let i = Arc::clone(&self.i);
|
||||||
let future = async {
|
let future = async {
|
||||||
let i = i;
|
let i = i;
|
||||||
@@ -148,7 +148,7 @@ mod test {
|
|||||||
fn test_memoized() {
|
fn test_memoized() {
|
||||||
use futures::executor::block_on;
|
use futures::executor::block_on;
|
||||||
|
|
||||||
let mut client = MemoizeClientHandle::new(TestClient {
|
let client = MemoizeClientHandle::new(TestClient {
|
||||||
i: Arc::new(Mutex::new(0)),
|
i: Arc::new(Mutex::new(0)),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -107,7 +107,7 @@ impl DnsHandle for DnsExchange {
|
|||||||
type Response = DnsExchangeSend;
|
type Response = DnsExchangeSend;
|
||||||
type Error = ProtoError;
|
type Error = ProtoError;
|
||||||
|
|
||||||
fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(&mut self, request: R) -> Self::Response {
|
fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(&self, request: R) -> Self::Response {
|
||||||
DnsExchangeSend {
|
DnsExchangeSend {
|
||||||
result: self.sender.send(request),
|
result: self.sender.send(request),
|
||||||
_sender: self.sender.clone(), // TODO: this shouldn't be necessary, currently the presence of Senders is what allows the background to track current users, it generally is dropped right after send, this makes sure that there is at least one active after send
|
_sender: self.sender.clone(), // TODO: this shouldn't be necessary, currently the presence of Senders is what allows the background to track current users, it generally is dropped right after send, this makes sure that there is at least one active after send
|
||||||
|
@@ -53,7 +53,7 @@ pub trait DnsHandle: 'static + Clone + Send + Sync + Unpin {
|
|||||||
/// * `request` - the fully constructed Message to send, note that most implementations of
|
/// * `request` - the fully constructed Message to send, note that most implementations of
|
||||||
/// will most likely be required to rewrite the QueryId, do no rely on that as
|
/// will most likely be required to rewrite the QueryId, do no rely on that as
|
||||||
/// being stable.
|
/// being stable.
|
||||||
fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(&mut self, request: R) -> Self::Response;
|
fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(&self, request: R) -> Self::Response;
|
||||||
|
|
||||||
/// A *classic* DNS query
|
/// A *classic* DNS query
|
||||||
///
|
///
|
||||||
@@ -63,7 +63,7 @@ pub trait DnsHandle: 'static + Clone + Send + Sync + Unpin {
|
|||||||
///
|
///
|
||||||
/// * `query` - the query to lookup
|
/// * `query` - the query to lookup
|
||||||
/// * `options` - options to use when constructing the message
|
/// * `options` - options to use when constructing the message
|
||||||
fn lookup(&mut self, query: Query, options: DnsRequestOptions) -> Self::Response {
|
fn lookup(&self, query: Query, options: DnsRequestOptions) -> Self::Response {
|
||||||
debug!("querying: {} {:?}", query.name(), query.query_type());
|
debug!("querying: {} {:?}", query.name(), query.query_type());
|
||||||
self.send(DnsRequest::new(build_message(query, options), options))
|
self.send(DnsRequest::new(build_message(query, options), options))
|
||||||
}
|
}
|
||||||
|
@@ -115,7 +115,7 @@ where
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn send<R: Into<DnsRequest>>(&mut self, request: R) -> Self::Response {
|
fn send<R: Into<DnsRequest>>(&self, request: R) -> Self::Response {
|
||||||
let mut request = request.into();
|
let mut request = request.into();
|
||||||
|
|
||||||
// backstop
|
// backstop
|
||||||
@@ -467,7 +467,7 @@ where
|
|||||||
/// as a success. Otherwise, a query is sent to get the DS record, and the DNSKEY is validated
|
/// as a success. Otherwise, a query is sent to get the DS record, and the DNSKEY is validated
|
||||||
/// against the DS record.
|
/// against the DS record.
|
||||||
async fn verify_dnskey_rrset<H, E>(
|
async fn verify_dnskey_rrset<H, E>(
|
||||||
mut handle: DnssecDnsHandle<H>,
|
handle: DnssecDnsHandle<H>,
|
||||||
rrset: Rrset,
|
rrset: Rrset,
|
||||||
options: DnsRequestOptions,
|
options: DnsRequestOptions,
|
||||||
) -> Result<Rrset, E>
|
) -> Result<Rrset, E>
|
||||||
@@ -715,7 +715,7 @@ where
|
|||||||
.filter_map(|rrsig|rrsig.into_data())
|
.filter_map(|rrsig|rrsig.into_data())
|
||||||
.map(|sig| {
|
.map(|sig| {
|
||||||
let rrset = Arc::clone(&rrset);
|
let rrset = Arc::clone(&rrset);
|
||||||
let mut handle = handle.clone_with_context();
|
let handle = handle.clone_with_context();
|
||||||
|
|
||||||
handle
|
handle
|
||||||
.lookup(
|
.lookup(
|
||||||
|
@@ -166,7 +166,7 @@ impl DnsHandle for BufDnsRequestStreamHandle {
|
|||||||
type Response = DnsResponseReceiver;
|
type Response = DnsResponseReceiver;
|
||||||
type Error = ProtoError;
|
type Error = ProtoError;
|
||||||
|
|
||||||
fn send<R: Into<DnsRequest>>(&mut self, request: R) -> Self::Response {
|
fn send<R: Into<DnsRequest>>(&self, request: R) -> Self::Response {
|
||||||
let request: DnsRequest = request.into();
|
let request: DnsRequest = request.into();
|
||||||
debug!(
|
debug!(
|
||||||
"enqueueing message:{}:{:?}",
|
"enqueueing message:{}:{:?}",
|
||||||
@@ -175,7 +175,8 @@ impl DnsHandle for BufDnsRequestStreamHandle {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let (request, oneshot) = OneshotDnsRequest::oneshot(request);
|
let (request, oneshot) = OneshotDnsRequest::oneshot(request);
|
||||||
try_oneshot!(self.sender.try_send(request).map_err(|_| {
|
let mut sender = self.sender.clone();
|
||||||
|
try_oneshot!(sender.try_send(request).map_err(|_| {
|
||||||
debug!("unable to enqueue message");
|
debug!("unable to enqueue message");
|
||||||
ProtoError::from(ProtoErrorKind::Busy)
|
ProtoError::from(ProtoErrorKind::Busy)
|
||||||
}));
|
}));
|
||||||
|
@@ -63,7 +63,7 @@ where
|
|||||||
type Response = Pin<Box<dyn Stream<Item = Result<DnsResponse, Self::Error>> + Send + Unpin>>;
|
type Response = Pin<Box<dyn Stream<Item = Result<DnsResponse, Self::Error>> + Send + Unpin>>;
|
||||||
type Error = <H as DnsHandle>::Error;
|
type Error = <H as DnsHandle>::Error;
|
||||||
|
|
||||||
fn send<R: Into<DnsRequest>>(&mut self, request: R) -> Self::Response {
|
fn send<R: Into<DnsRequest>>(&self, request: R) -> Self::Response {
|
||||||
let request = request.into();
|
let request = request.into();
|
||||||
|
|
||||||
// need to clone here so that the retry can resend if necessary...
|
// need to clone here so that the retry can resend if necessary...
|
||||||
@@ -165,7 +165,7 @@ mod test {
|
|||||||
type Response = Box<dyn Stream<Item = Result<DnsResponse, ProtoError>> + Send + Unpin>;
|
type Response = Box<dyn Stream<Item = Result<DnsResponse, ProtoError>> + Send + Unpin>;
|
||||||
type Error = ProtoError;
|
type Error = ProtoError;
|
||||||
|
|
||||||
fn send<R: Into<DnsRequest>>(&mut self, _: R) -> Self::Response {
|
fn send<R: Into<DnsRequest>>(&self, _: R) -> Self::Response {
|
||||||
let i = self.attempts.load(Ordering::SeqCst);
|
let i = self.attempts.load(Ordering::SeqCst);
|
||||||
|
|
||||||
if (i > self.retries || self.retries - i == 0) && self.last_succeed {
|
if (i > self.retries || self.retries - i == 0) && self.last_succeed {
|
||||||
@@ -181,7 +181,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_retry() {
|
fn test_retry() {
|
||||||
let mut handle = RetryDnsHandle::new(
|
let handle = RetryDnsHandle::new(
|
||||||
TestClient {
|
TestClient {
|
||||||
last_succeed: true,
|
last_succeed: true,
|
||||||
retries: 1,
|
retries: 1,
|
||||||
@@ -196,7 +196,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_error() {
|
fn test_error() {
|
||||||
let mut client = RetryDnsHandle::new(
|
let client = RetryDnsHandle::new(
|
||||||
TestClient {
|
TestClient {
|
||||||
last_succeed: false,
|
last_succeed: false,
|
||||||
retries: 1,
|
retries: 1,
|
||||||
|
@@ -204,11 +204,11 @@ impl<P: ConnectionProvider> DnsHandle for LookupEither<P> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(&mut self, request: R) -> Self::Response {
|
fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(&self, request: R) -> Self::Response {
|
||||||
match *self {
|
match *self {
|
||||||
Self::Retry(ref mut c) => c.send(request),
|
Self::Retry(ref c) => c.send(request),
|
||||||
#[cfg(feature = "dnssec")]
|
#[cfg(feature = "dnssec")]
|
||||||
Self::Secure(ref mut c) => c.send(request),
|
Self::Secure(ref c) => c.send(request),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -557,7 +557,7 @@ pub mod tests {
|
|||||||
type Response = Pin<Box<dyn Stream<Item = Result<DnsResponse, ResolveError>> + Send>>;
|
type Response = Pin<Box<dyn Stream<Item = Result<DnsResponse, ResolveError>> + Send>>;
|
||||||
type Error = ResolveError;
|
type Error = ResolveError;
|
||||||
|
|
||||||
fn send<R: Into<DnsRequest>>(&mut self, _: R) -> Self::Response {
|
fn send<R: Into<DnsRequest>>(&self, _: R) -> Self::Response {
|
||||||
Box::pin(once(
|
Box::pin(once(
|
||||||
future::ready(self.messages.lock().unwrap().pop().unwrap_or_else(empty)).boxed(),
|
future::ready(self.messages.lock().unwrap().pop().unwrap_or_else(empty)).boxed(),
|
||||||
))
|
))
|
||||||
|
@@ -474,7 +474,7 @@ pub mod tests {
|
|||||||
Pin<Box<dyn Stream<Item = Result<DnsResponse, ResolveError>> + Send + Unpin>>;
|
Pin<Box<dyn Stream<Item = Result<DnsResponse, ResolveError>> + Send + Unpin>>;
|
||||||
type Error = ResolveError;
|
type Error = ResolveError;
|
||||||
|
|
||||||
fn send<R: Into<DnsRequest>>(&mut self, _: R) -> Self::Response {
|
fn send<R: Into<DnsRequest>>(&self, _: R) -> Self::Response {
|
||||||
Box::pin(once(future::ready(
|
Box::pin(once(future::ready(
|
||||||
self.messages.lock().unwrap().pop().unwrap_or_else(empty),
|
self.messages.lock().unwrap().pop().unwrap_or_else(empty),
|
||||||
)))
|
)))
|
||||||
|
@@ -233,7 +233,7 @@ impl DnsHandle for GenericConnection {
|
|||||||
type Response = ConnectionResponse;
|
type Response = ConnectionResponse;
|
||||||
type Error = ResolveError;
|
type Error = ResolveError;
|
||||||
|
|
||||||
fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(&mut self, request: R) -> Self::Response {
|
fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(&self, request: R) -> Self::Response {
|
||||||
ConnectionResponse(self.0.send(request))
|
ConnectionResponse(self.0.send(request))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -128,7 +128,7 @@ where
|
|||||||
mut self,
|
mut self,
|
||||||
request: R,
|
request: R,
|
||||||
) -> Result<DnsResponse, ResolveError> {
|
) -> Result<DnsResponse, ResolveError> {
|
||||||
let mut client = self.connected_mut_client().await?;
|
let client = self.connected_mut_client().await?;
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
let response = client.send(request).first_answer().await;
|
let response = client.send(request).first_answer().await;
|
||||||
let rtt = now.elapsed();
|
let rtt = now.elapsed();
|
||||||
@@ -183,7 +183,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: there needs to be some way of customizing the connection based on EDNS options from the server side...
|
// TODO: there needs to be some way of customizing the connection based on EDNS options from the server side...
|
||||||
fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(&mut self, request: R) -> Self::Response {
|
fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(&self, request: R) -> Self::Response {
|
||||||
let this = self.clone();
|
let this = self.clone();
|
||||||
// if state is failed, return future::err(), unless retry delay expired..
|
// if state is failed, return future::err(), unless retry delay expired..
|
||||||
Box::pin(once(this.inner_send(request)))
|
Box::pin(once(this.inner_send(request)))
|
||||||
@@ -289,7 +289,7 @@ mod tests {
|
|||||||
|
|
||||||
let name = Name::parse("www.example.com.", None).unwrap();
|
let name = Name::parse("www.example.com.", None).unwrap();
|
||||||
let response = io_loop
|
let response = io_loop
|
||||||
.block_on(name_server.then(|mut name_server| {
|
.block_on(name_server.then(|name_server| {
|
||||||
name_server
|
name_server
|
||||||
.lookup(
|
.lookup(
|
||||||
Query::query(name.clone(), RecordType::A),
|
Query::query(name.clone(), RecordType::A),
|
||||||
@@ -323,7 +323,7 @@ mod tests {
|
|||||||
|
|
||||||
let name = Name::parse("www.example.com.", None).unwrap();
|
let name = Name::parse("www.example.com.", None).unwrap();
|
||||||
assert!(io_loop
|
assert!(io_loop
|
||||||
.block_on(name_server.then(|mut name_server| {
|
.block_on(name_server.then(|name_server| {
|
||||||
name_server
|
name_server
|
||||||
.lookup(
|
.lookup(
|
||||||
Query::query(name.clone(), RecordType::A),
|
Query::query(name.clone(), RecordType::A),
|
||||||
|
@@ -229,7 +229,7 @@ where
|
|||||||
type Response = Pin<Box<dyn Stream<Item = Result<DnsResponse, ResolveError>> + Send>>;
|
type Response = Pin<Box<dyn Stream<Item = Result<DnsResponse, ResolveError>> + Send>>;
|
||||||
type Error = ResolveError;
|
type Error = ResolveError;
|
||||||
|
|
||||||
fn send<R: Into<DnsRequest>>(&mut self, request: R) -> Self::Response {
|
fn send<R: Into<DnsRequest>>(&self, request: R) -> Self::Response {
|
||||||
let opts = self.options;
|
let opts = self.options;
|
||||||
let request = request.into();
|
let request = request.into();
|
||||||
let datagram_conns = Arc::clone(&self.datagram_conns);
|
let datagram_conns = Arc::clone(&self.datagram_conns);
|
||||||
@@ -360,7 +360,7 @@ where
|
|||||||
|
|
||||||
let mut requests = par_conns
|
let mut requests = par_conns
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(move |mut conn| {
|
.map(move |conn| {
|
||||||
conn.send(request_cont.clone())
|
conn.send(request_cont.clone())
|
||||||
.first_answer()
|
.first_answer()
|
||||||
.map(|result| result.map_err(|e| (conn, e)))
|
.map(|result| result.map_err(|e| (conn, e)))
|
||||||
@@ -516,7 +516,7 @@ mod tests {
|
|||||||
resolver_config.add_name_server(config2);
|
resolver_config.add_name_server(config2);
|
||||||
|
|
||||||
let io_loop = Runtime::new().unwrap();
|
let io_loop = Runtime::new().unwrap();
|
||||||
let mut pool = GenericNameServerPool::tokio_from_config(
|
let pool = GenericNameServerPool::tokio_from_config(
|
||||||
&resolver_config,
|
&resolver_config,
|
||||||
&ResolverOpts::default(),
|
&ResolverOpts::default(),
|
||||||
TokioRuntimeProvider::new(),
|
TokioRuntimeProvider::new(),
|
||||||
@@ -582,7 +582,7 @@ mod tests {
|
|||||||
let name_servers: Arc<[_]> = Arc::from([name_server]);
|
let name_servers: Arc<[_]> = Arc::from([name_server]);
|
||||||
|
|
||||||
#[cfg(not(feature = "mdns"))]
|
#[cfg(not(feature = "mdns"))]
|
||||||
let mut pool = GenericNameServerPool::from_nameservers_test(
|
let pool = GenericNameServerPool::from_nameservers_test(
|
||||||
&opts,
|
&opts,
|
||||||
Arc::from([]),
|
Arc::from([]),
|
||||||
Arc::clone(&name_servers),
|
Arc::clone(&name_servers),
|
||||||
|
@@ -196,7 +196,7 @@ where
|
|||||||
type Response = Pin<Box<dyn Stream<Item = Result<DnsResponse, E>> + Send>>;
|
type Response = Pin<Box<dyn Stream<Item = Result<DnsResponse, E>> + Send>>;
|
||||||
type Error = E;
|
type Error = E;
|
||||||
|
|
||||||
fn send<R: Into<DnsRequest>>(&mut self, _: R) -> Self::Response {
|
fn send<R: Into<DnsRequest>>(&self, _: R) -> Self::Response {
|
||||||
let mut messages = self.messages.lock().expect("failed to lock at messages");
|
let mut messages = self.messages.lock().expect("failed to lock at messages");
|
||||||
println!("MockClientHandle::send message count: {}", messages.len());
|
println!("MockClientHandle::send message count: {}", messages.len());
|
||||||
|
|
||||||
@@ -247,7 +247,7 @@ pub fn error<E>(error: E) -> Result<DnsResponse, E> {
|
|||||||
|
|
||||||
pub trait OnSend: Clone + Send + Sync + 'static {
|
pub trait OnSend: Clone + Send + Sync + 'static {
|
||||||
fn on_send<E>(
|
fn on_send<E>(
|
||||||
&mut self,
|
&self,
|
||||||
response: Result<DnsResponse, E>,
|
response: Result<DnsResponse, E>,
|
||||||
) -> Pin<Box<dyn Future<Output = Result<DnsResponse, E>> + Send>>
|
) -> Pin<Box<dyn Future<Output = Result<DnsResponse, E>> + Send>>
|
||||||
where
|
where
|
||||||
|
@@ -645,7 +645,7 @@ impl OnSendBarrier {
|
|||||||
|
|
||||||
impl OnSend for OnSendBarrier {
|
impl OnSend for OnSendBarrier {
|
||||||
fn on_send<E>(
|
fn on_send<E>(
|
||||||
&mut self,
|
&self,
|
||||||
response: Result<DnsResponse, E>,
|
response: Result<DnsResponse, E>,
|
||||||
) -> Pin<Box<dyn Future<Output = Result<DnsResponse, E>> + Send>>
|
) -> Pin<Box<dyn Future<Output = Result<DnsResponse, E>> + Send>>
|
||||||
where
|
where
|
||||||
|
@@ -23,7 +23,7 @@ impl DnsHandle for TestClient {
|
|||||||
type Response = Box<dyn Stream<Item = Result<DnsResponse, Self::Error>> + Send + Unpin>;
|
type Response = Box<dyn Stream<Item = Result<DnsResponse, Self::Error>> + Send + Unpin>;
|
||||||
type Error = ResolveError;
|
type Error = ResolveError;
|
||||||
|
|
||||||
fn send<R: Into<DnsRequest>>(&mut self, _: R) -> Self::Response {
|
fn send<R: Into<DnsRequest>>(&self, _: R) -> Self::Response {
|
||||||
let i = self.attempts.load(Ordering::SeqCst);
|
let i = self.attempts.load(Ordering::SeqCst);
|
||||||
|
|
||||||
if i > self.retries || self.retries - i == 0 {
|
if i > self.retries || self.retries - i == 0 {
|
||||||
|
Reference in New Issue
Block a user