1
0

logging fragment id as 1-indexed

This commit is contained in:
EAimTY 2023-06-03 19:41:41 +09:00
parent dd9301e819
commit f298fd7d25
3 changed files with 8 additions and 14 deletions

View File

@ -52,13 +52,6 @@ impl Connection {
Err(err) => Err(Error::Model(err)), Err(err) => Err(Error::Model(err)),
Ok(Task::Packet(pkt)) => match self.udp_relay_mode { Ok(Task::Packet(pkt)) => match self.udp_relay_mode {
UdpRelayMode::Quic => { UdpRelayMode::Quic => {
log::info!(
"[relay] [packet] [{assoc_id:#06x}] [from-quic] [{pkt_id:#06x}] {frag_id}/{frag_total}",
assoc_id = pkt.assoc_id(),
pkt_id = pkt.pkt_id(),
frag_id = pkt.frag_id(),
frag_total = pkt.frag_total(),
);
Self::handle_packet(pkt).await; Self::handle_packet(pkt).await;
Ok(()) Ok(())
} }
@ -92,13 +85,6 @@ impl Connection {
Err(err) => Err(Error::Model(err)), Err(err) => Err(Error::Model(err)),
Ok(Task::Packet(pkt)) => match self.udp_relay_mode { Ok(Task::Packet(pkt)) => match self.udp_relay_mode {
UdpRelayMode::Native => { UdpRelayMode::Native => {
log::info!(
"[relay] [packet] [{assoc_id:#06x}] [from-native] [{pkt_id:#06x}] {frag_id}/{frag_total}",
assoc_id = pkt.assoc_id(),
pkt_id = pkt.pkt_id(),
frag_id = pkt.frag_id(),
frag_total = pkt.frag_total(),
);
Self::handle_packet(pkt).await; Self::handle_packet(pkt).await;
Ok(()) Ok(())
} }

View File

@ -105,6 +105,12 @@ impl Connection {
unreachable!() unreachable!()
}; };
log::info!(
"[relay] [packet] [{assoc_id:#06x}] [from-{mode}] [{pkt_id:#06x}] fragment {frag_id}/{frag_total}",
frag_id = pkt.frag_id() + 1,
frag_total = pkt.frag_total(),
);
match pkt.accept().await { match pkt.accept().await {
Ok(Some((pkt, addr, _))) => { Ok(Some((pkt, addr, _))) => {
log::info!("[relay] [packet] [{assoc_id:#06x}] [from-{mode}] [{pkt_id:#06x}] from {addr}"); log::info!("[relay] [packet] [{assoc_id:#06x}] [from-{mode}] [{pkt_id:#06x}] from {addr}");

View File

@ -90,6 +90,7 @@ impl Connection {
id = self.id(), id = self.id(),
addr = self.inner.remote_address(), addr = self.inner.remote_address(),
user = self.auth, user = self.auth,
frag_id = frag_id + 1,
); );
self.udp_relay_mode.store(Some(mode)); self.udp_relay_mode.store(Some(mode));
@ -103,6 +104,7 @@ impl Connection {
id = self.id(), id = self.id(),
addr = self.inner.remote_address(), addr = self.inner.remote_address(),
user = self.auth, user = self.auth,
frag_id = frag_id + 1,
); );
return; return;
} }