diff options
author | Mike Yu <yumike@google.com> | 2022-02-10 20:38:43 +0800 |
---|---|---|
committer | Mike Yu <yumike@google.com> | 2022-02-23 15:47:10 +0800 |
commit | 78f82d67354975a794b6477c45fe6bc6fb9a1931 (patch) | |
tree | e9dfbe8f5a898598d4230be8242ac89f92e0cec9 /doh | |
parent | dfbcdde55ae5d92e389bf2f7fceb7d29f30c3cdc (diff) | |
download | DnsResolver-78f82d67354975a794b6477c45fe6bc6fb9a1931.tar.gz |
DoH: Use trace_id() in logging to differentiate between connections
As multiple connections on the same netId can exist at the same
time, use trace_id() to differentiate between them.
Also, upgrade timer logging message from trace level to debug level.
Bug: 215818810
Test: built dnsresolver pass
Change-Id: Idacb8310c9b1b66551abf8b12216b1be2db1705e
Diffstat (limited to 'doh')
-rw-r--r-- | doh/connection/driver.rs | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/doh/connection/driver.rs b/doh/connection/driver.rs index ef22b72c..d4c5bd5d 100644 --- a/doh/connection/driver.rs +++ b/doh/connection/driver.rs @@ -17,7 +17,7 @@ use crate::boot_time; use crate::boot_time::BootTime; -use log::{debug, trace, warn}; +use log::{debug, warn}; use quiche::h3; use std::collections::HashMap; use std::default::Default; @@ -105,7 +105,7 @@ struct H3Driver { } async fn optional_timeout(timeout: Option<boot_time::Duration>, net_id: u32) { - trace!("optional_timeout: timeout={:?}, network {}", timeout, net_id); + debug!("optional_timeout: timeout={:?}, network {}", timeout, net_id); match timeout { Some(timeout) => boot_time::sleep(timeout).await, None => future::pending().await, @@ -154,7 +154,8 @@ impl Driver { if self.quiche_conn.is_closed() { // TODO: Also log local_error() once Quiche 0.10.0 is available. debug!( - "Connection closed on network {}, peer_error={:x?}", + "Connection {} closed on network {}, peer_error={:x?}", + self.quiche_conn.trace_id(), self.net_id, self.quiche_conn.peer_error() ); @@ -171,7 +172,8 @@ impl Driver { // TODO: avoid running the code below more than once. // TODO: Also log local_error() once Quiche 0.10.0 is available. debug!( - "Connection is draining on network {}, peer_error={:x?}", + "Connection {} is draining on network {}, peer_error={:x?}", + self.quiche_conn.trace_id(), self.net_id, self.quiche_conn.peer_error() ); @@ -207,6 +209,11 @@ impl Driver { // If the QUIC connection is live, but the HTTP/3 is not, try to bring it up if self.quiche_conn.is_established() { + debug!( + "Connection {} established on network {}", + self.quiche_conn.trace_id(), + self.net_id + ); let h3_config = h3::Config::new()?; let h3_conn = h3::Connection::with_transport(&mut self.quiche_conn, &h3_config)?; self = H3Driver::new(self, h3_conn).drive().await?; @@ -455,7 +462,12 @@ impl H3Driver { } async fn shutdown(&mut self, send_goaway: bool, msg: &[u8]) -> Result<()> { - debug!("Closing connection on network {} with msg {:?}", self.driver.net_id, msg); + debug!( + "Closing connection {} on network {} with msg {:?}", + self.driver.quiche_conn.trace_id(), + self.driver.net_id, + msg + ); self.driver.request_rx.close(); while self.driver.request_rx.recv().await.is_some() {} self.closing = true; |