Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sprinkle send request prints #5

Open
wants to merge 1 commit into
base: release/0.24.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions bin/tests/server_harness/mut_message_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ impl<C: ClientHandle + Unpin> DnsHandle for MutMessageHandle<C> {

#[allow(unused_mut)]
fn send<R: Into<DnsRequest> + Unpin>(&self, request: R) -> Self::Response {
tracing::debug!("Sending request");
let mut request = request.into();

#[cfg(feature = "dnssec")]
Expand Down
5 changes: 4 additions & 1 deletion crates/client/src/client/async_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ impl DnsHandle for AsyncClient {
type Error = ProtoError;

fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(&self, request: R) -> Self::Response {
self.exchange.send(request)
debug!("Sending dns request");
let res = self.exchange.send(request);
debug!("Dns response recieved");
res
}

fn is_using_edns(&self) -> bool {
Expand Down
1 change: 1 addition & 0 deletions crates/client/src/client/async_secure_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ impl DnsHandle for AsyncDnssecClient {
type Error = ProtoError;

fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(&self, request: R) -> Self::Response {
tracing::debug!("Sending request");
self.client.send(request)
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/client/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ pub trait Client {
&self,
msg: R,
) -> Vec<ClientResult<DnsResponse>> {
tracing::debug!("Sending request");
let (client, runtime) = match self.spawn_client() {
Ok(c_r) => c_r,
Err(e) => return vec![Err(e)],
Expand Down
1 change: 1 addition & 0 deletions crates/proto/src/xfer/dns_exchange.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ impl DnsHandle for DnsExchange {
type Error = ProtoError;

fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(&self, request: R) -> Self::Response {
tracing::debug!("Sending request");
DnsExchangeSend {
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
Expand Down
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 return");
r
}
}

Expand Down
1 change: 1 addition & 0 deletions crates/proto/src/xfer/dns_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ impl DerefMut for DnsRequest {

impl From<Message> for DnsRequest {
fn from(message: Message) -> Self {
tracing::debug!("Converting to DnsRequest");
Self::new(message, DnsRequestOptions::default())
}
}
1 change: 1 addition & 0 deletions crates/proto/src/xfer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ impl DnsHandle for BufDnsRequestStreamHandle {
type Error = ProtoError;

fn send<R: Into<DnsRequest>>(&self, request: R) -> Self::Response {
tracing::debug!("Sending request");
let request: DnsRequest = request.into();
debug!(
"enqueueing message:{}:{:?}",
Expand Down
12 changes: 10 additions & 2 deletions crates/proto/src/xfer/retry_dns_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ where
type Error = <H as DnsHandle>::Error;

fn send<R: Into<DnsRequest>>(&self, request: R) -> Self::Response {
tracing::debug!("Sending request");
let request = request.into();

tracing::debug!("Request obj converted");
// need to clone here so that the retry can resend if necessary...
// obviously it would be nice to be lazy about this...
let stream = self.handle.send(request.clone());
Expand Down Expand Up @@ -99,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 error {e}");
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
7 changes: 5 additions & 2 deletions crates/resolver/src/lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,14 @@ impl<P: ConnectionProvider> DnsHandle for LookupEither<P> {
}

fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(&self, request: R) -> Self::Response {
match *self {
tracing::debug!("Sending request");
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
1 change: 1 addition & 0 deletions crates/resolver/src/name_server/connection_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ impl DnsHandle for GenericConnection {
type Error = ResolveError;

fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(&self, request: R) -> Self::Response {
tracing::debug!("Sending request");
ConnectionResponse(self.0.send(request))
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/resolver/src/name_server/name_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ where
// 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>(&self, request: R) -> Self::Response {
let this = self.clone();
tracing::debug!("Sending request");
// if state is failed, return future::err(), unless retry delay expired..
Box::pin(once(this.inner_send(request)))
}
Expand Down
1 change: 1 addition & 0 deletions crates/resolver/src/name_server/name_server_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ where
type Error = ResolveError;

fn send<R: Into<DnsRequest>>(&self, request: R) -> Self::Response {
tracing::debug!("Sending request");
let opts = self.options.clone();
let request = request.into();
let datagram_conns = Arc::clone(&self.datagram_conns);
Expand Down
Loading