1
0

fixed connection id logging length to 8

This commit is contained in:
EAimTY 2023-05-30 18:15:03 +09:00
parent b8ea5747c8
commit e1c54c065c
4 changed files with 24 additions and 24 deletions

View File

@ -10,7 +10,7 @@ use tuic_quinn::Task;
impl Connection { impl Connection {
pub(crate) async fn handle_uni_stream(self, recv: RecvStream, _reg: Register) { pub(crate) async fn handle_uni_stream(self, recv: RecvStream, _reg: Register) {
log::debug!( log::debug!(
"[{id:#08x}] [{addr}] [{user}] incoming unidirectional stream", "[{id:#010x}] [{addr}] [{user}] incoming unidirectional stream",
id = self.id(), id = self.id(),
addr = self.inner.remote_address(), addr = self.inner.remote_address(),
user = self.auth, user = self.auth,
@ -59,7 +59,7 @@ impl Connection {
Ok(_) => unreachable!(), // already filtered in `tuic_quinn` Ok(_) => unreachable!(), // already filtered in `tuic_quinn`
Err(err) => { Err(err) => {
log::warn!( log::warn!(
"[{id:#08x}] [{addr}] [{user}] handling incoming unidirectional stream error: {err}", "[{id:#010x}] [{addr}] [{user}] handling incoming unidirectional stream error: {err}",
id = self.id(), id = self.id(),
addr = self.inner.remote_address(), addr = self.inner.remote_address(),
user = self.auth, user = self.auth,
@ -75,7 +75,7 @@ impl Connection {
_reg: Register, _reg: Register,
) { ) {
log::debug!( log::debug!(
"[{id:#08x}] [{addr}] [{user}] incoming bidirectional stream", "[{id:#010x}] [{addr}] [{user}] incoming bidirectional stream",
id = self.id(), id = self.id(),
addr = self.inner.remote_address(), addr = self.inner.remote_address(),
user = self.auth, user = self.auth,
@ -112,7 +112,7 @@ impl Connection {
Ok(_) => unreachable!(), // already filtered in `tuic_quinn` Ok(_) => unreachable!(), // already filtered in `tuic_quinn`
Err(err) => { Err(err) => {
log::warn!( log::warn!(
"[{id:#08x}] [{addr}] [{user}] handling incoming bidirectional stream error: {err}", "[{id:#010x}] [{addr}] [{user}] handling incoming bidirectional stream error: {err}",
id = self.id(), id = self.id(),
addr = self.inner.remote_address(), addr = self.inner.remote_address(),
user = self.auth, user = self.auth,
@ -124,7 +124,7 @@ impl Connection {
pub(crate) async fn handle_datagram(self, dg: Bytes) { pub(crate) async fn handle_datagram(self, dg: Bytes) {
log::debug!( log::debug!(
"[{id:#08x}] [{addr}] [{user}] incoming datagram", "[{id:#010x}] [{addr}] [{user}] incoming datagram",
id = self.id(), id = self.id(),
addr = self.inner.remote_address(), addr = self.inner.remote_address(),
user = self.auth, user = self.auth,
@ -153,7 +153,7 @@ impl Connection {
Ok(_) => unreachable!(), Ok(_) => unreachable!(),
Err(err) => { Err(err) => {
log::warn!( log::warn!(
"[{id:#08x}] [{addr}] [{user}] handling incoming datagram error: {err}", "[{id:#010x}] [{addr}] [{user}] handling incoming datagram error: {err}",
id = self.id(), id = self.id(),
addr = self.inner.remote_address(), addr = self.inner.remote_address(),
user = self.auth, user = self.auth,

View File

@ -17,7 +17,7 @@ use tuic_quinn::{Authenticate, Connect, Packet};
impl Connection { impl Connection {
pub(super) async fn handle_authenticate(&self, auth: Authenticate) { pub(super) async fn handle_authenticate(&self, auth: Authenticate) {
log::info!( log::info!(
"[{id:#08x}] [{addr}] [{user}] [authenticate] {auth_uuid}", "[{id:#010x}] [{addr}] [{user}] [authenticate] {auth_uuid}",
id = self.id(), id = self.id(),
addr = self.inner.remote_address(), addr = self.inner.remote_address(),
user = self.auth, user = self.auth,
@ -29,7 +29,7 @@ impl Connection {
let target_addr = conn.addr().to_string(); let target_addr = conn.addr().to_string();
log::info!( log::info!(
"[{id:#08x}] [{addr}] [{user}] [connect] {target_addr}", "[{id:#010x}] [{addr}] [{user}] [connect] {target_addr}",
id = self.id(), id = self.id(),
addr = self.inner.remote_address(), addr = self.inner.remote_address(),
user = self.auth, user = self.auth,
@ -71,7 +71,7 @@ impl Connection {
match process.await { match process.await {
Ok(()) => {} Ok(()) => {}
Err(err) => log::warn!( Err(err) => log::warn!(
"[{id:#08x}] [{addr}] [{user}] [connect] {target_addr}: {err}", "[{id:#010x}] [{addr}] [{user}] [connect] {target_addr}: {err}",
id = self.id(), id = self.id(),
addr = self.inner.remote_address(), addr = self.inner.remote_address(),
user = self.auth, user = self.auth,
@ -86,7 +86,7 @@ impl Connection {
let frag_total = pkt.frag_total(); let frag_total = pkt.frag_total();
log::info!( log::info!(
"[{id:#08x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [from-{mode}] [{pkt_id:#06x}] {frag_id}/{frag_total}", "[{id:#010x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [from-{mode}] [{pkt_id:#06x}] {frag_id}/{frag_total}",
id = self.id(), id = self.id(),
addr = self.inner.remote_address(), addr = self.inner.remote_address(),
user = self.auth, user = self.auth,
@ -99,7 +99,7 @@ impl Connection {
Ok(Some(res)) => res, Ok(Some(res)) => res,
Err(err) => { Err(err) => {
log::warn!( log::warn!(
"[{id:#08x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [from-{mode}] [{pkt_id:#06x}] {frag_id}/{frag_total}: {err}", "[{id:#010x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [from-{mode}] [{pkt_id:#06x}] {frag_id}/{frag_total}: {err}",
id = self.id(), id = self.id(),
addr = self.inner.remote_address(), addr = self.inner.remote_address(),
user = self.auth, user = self.auth,
@ -110,7 +110,7 @@ impl Connection {
let process = async { let process = async {
log::info!( log::info!(
"[{id:#08x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [from-{mode}] [{pkt_id:#06x}] {src_addr}", "[{id:#010x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [from-{mode}] [{pkt_id:#06x}] {src_addr}",
id = self.id(), id = self.id(),
addr = self.inner.remote_address(), addr = self.inner.remote_address(),
user = self.auth, user = self.auth,
@ -140,7 +140,7 @@ impl Connection {
if let Err(err) = process.await { if let Err(err) = process.await {
log::warn!( log::warn!(
"[{id:#08x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [from-{mode}] [{pkt_id:#06x}] {src_addr}: {err}", "[{id:#010x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [from-{mode}] [{pkt_id:#06x}] {src_addr}: {err}",
id = self.id(), id = self.id(),
addr = self.inner.remote_address(), addr = self.inner.remote_address(),
user = self.auth, user = self.auth,
@ -151,7 +151,7 @@ impl Connection {
pub(super) async fn handle_dissociate(&self, assoc_id: u16) { pub(super) async fn handle_dissociate(&self, assoc_id: u16) {
log::info!( log::info!(
"[{id:#08x}] [{addr}] [{user}] [dissociate] [{assoc_id:#06x}]", "[{id:#010x}] [{addr}] [{user}] [dissociate] [{assoc_id:#06x}]",
id = self.id(), id = self.id(),
addr = self.inner.remote_address(), addr = self.inner.remote_address(),
user = self.auth, user = self.auth,
@ -164,7 +164,7 @@ impl Connection {
pub(super) async fn handle_heartbeat(&self) { pub(super) async fn handle_heartbeat(&self) {
log::info!( log::info!(
"[{id:#08x}] [{addr}] [{user}] [heartbeat]", "[{id:#010x}] [{addr}] [{user}] [heartbeat]",
id = self.id(), id = self.id(),
addr = self.inner.remote_address(), addr = self.inner.remote_address(),
user = self.auth, user = self.auth,
@ -175,7 +175,7 @@ impl Connection {
let addr_display = addr.to_string(); let addr_display = addr.to_string();
log::info!( log::info!(
"[{id:#08x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [to-{mode}] {target_addr}", "[{id:#010x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [to-{mode}] {target_addr}",
id = self.id(), id = self.id(),
addr = self.inner.remote_address(), addr = self.inner.remote_address(),
user = self.auth, user = self.auth,
@ -190,7 +190,7 @@ impl Connection {
if let Err(err) = res { if let Err(err) = res {
log::warn!( log::warn!(
"[{id:#08x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [to-{mode}] {target_addr}: {err}", "[{id:#010x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] [to-{mode}] {target_addr}: {err}",
id = self.id(), id = self.id(),
addr = self.inner.remote_address(), addr = self.inner.remote_address(),
user = self.auth, user = self.auth,

View File

@ -75,7 +75,7 @@ impl Connection {
match init.await { match init.await {
Ok(conn) => { Ok(conn) => {
log::info!( log::info!(
"[{id:#08x}] [{addr}] [{user}] connection established", "[{id:#010x}] [{addr}] [{user}] connection established",
id = conn.id(), id = conn.id(),
user = conn.auth, user = conn.auth,
); );
@ -106,13 +106,13 @@ impl Connection {
Err(err) if err.is_locally_closed() => {} Err(err) if err.is_locally_closed() => {}
Err(err) if err.is_timeout_closed() => { Err(err) if err.is_timeout_closed() => {
log::debug!( log::debug!(
"[{id:#08x}] [{addr}] [{user}] connection timeout", "[{id:#010x}] [{addr}] [{user}] connection timeout",
id = conn.id(), id = conn.id(),
user = conn.auth, user = conn.auth,
); );
} }
Err(err) => log::warn!( Err(err) => log::warn!(
"[{id:#08x}] [{addr}] [{user}] connection error: {err}", "[{id:#010x}] [{addr}] [{user}] connection error: {err}",
id = conn.id(), id = conn.id(),
user = conn.auth, user = conn.auth,
), ),
@ -122,7 +122,7 @@ impl Connection {
Err(err) if err.is_locally_closed() || err.is_timeout_closed() => unreachable!(), Err(err) if err.is_locally_closed() || err.is_timeout_closed() => unreachable!(),
Err(err) => { Err(err) => {
log::warn!( log::warn!(
"[{id:#08x}] [{addr}] [unauthenticated] connection establishing error: {err}", "[{id:#010x}] [{addr}] [unauthenticated] connection establishing error: {err}",
id = usize::MAX, id = usize::MAX,
) )
} }
@ -173,7 +173,7 @@ impl Connection {
if self.auth.get().is_none() { if self.auth.get().is_none() {
log::warn!( log::warn!(
"[{id:#08x}] [{addr}] [unauthenticated] [authenticate] timeout", "[{id:#010x}] [{addr}] [unauthenticated] [authenticate] timeout",
id = self.id(), id = self.id(),
addr = self.inner.remote_address(), addr = self.inner.remote_address(),
); );
@ -190,7 +190,7 @@ impl Connection {
} }
log::debug!( log::debug!(
"[{id:#08x}] [{addr}] [{user}] packet fragment garbage collecting event", "[{id:#010x}] [{addr}] [{user}] packet fragment garbage collecting event",
id = self.id(), id = self.id(),
addr = self.inner.remote_address(), addr = self.inner.remote_address(),
user = self.auth, user = self.auth,

View File

@ -98,7 +98,7 @@ impl UdpSession {
Ok(res) => res, Ok(res) => res,
Err(err) => { Err(err) => {
log::warn!( log::warn!(
"[{id:#08x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] outbound listening error: {err}", "[{id:#010x}] [{addr}] [{user}] [packet] [{assoc_id:#06x}] outbound listening error: {err}",
id = session_listening.0.conn.id(), id = session_listening.0.conn.id(),
addr = session_listening.0.conn.inner.remote_address(), addr = session_listening.0.conn.inner.remote_address(),
user = session_listening.0.conn.auth, user = session_listening.0.conn.auth,