Skip to content

Commit

Permalink
Sprinle more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Hasan6979 committed Jan 30, 2025
1 parent 85613d0 commit 5c24fd7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion crates/proto/src/xfer/dns_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ pub trait DnsHandle: 'static + Clone + Send + Sync + Unpin {
/// * `options` - options to use when constructing the message
fn lookup(&self, query: Query, options: DnsRequestOptions) -> Self::Response {
debug!("querying: {} {:?}", query.name(), query.query_type());
self.send(DnsRequest::new(build_message(query, options), options))
let r = self.send(DnsRequest::new(build_message(query, options), options));
tracing::debug!("lookup");
r
}
}

Expand Down
9 changes: 8 additions & 1 deletion crates/proto/src/xfer/retry_dns_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,23 +100,30 @@ where
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
// loop over the stream, on errors, spawn a new stream
// on ready and not ready return.
tracing::debug!("poll_next");
loop {
match self.stream.poll_next_unpin(cx) {
Poll::Ready(Some(Err(e))) => {
tracing::debug!("poll ready");
if self.remaining_attempts == 0 || !e.should_retry() {
return Poll::Ready(Some(Err(e)));
}

if e.attempted() {
tracing::debug!("poll attempted");
self.remaining_attempts -= 1;
}

// TODO: if the "sent" Message is part of the error result,
// then we can just reuse it... and no clone necessary
let request = self.request.clone();
tracing::debug!("sending ready");
self.stream = self.handle.send(request);
}
poll => return poll,
poll => {
tracing::debug!("poll return {:?}", poll);
return poll;
}
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions crates/resolver/src/lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,13 @@ impl<P: ConnectionProvider> DnsHandle for LookupEither<P> {

fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(&self, request: R) -> Self::Response {
tracing::debug!("Sending request");
match *self {
let r = match *self {
Self::Retry(ref c) => c.send(request),
#[cfg(feature = "dnssec")]
Self::Secure(ref c) => c.send(request),
}
};
tracing::debug!("reply");
r
}
}

Expand Down

0 comments on commit 5c24fd7

Please sign in to comment.