fix: login_username_extract span added for extended logging information

This commit is contained in:
Tamipes 2026-01-29 09:56:21 +01:00
parent bebca902df
commit e403d93dc2

View file

@ -115,8 +115,18 @@ async fn process_connection<T: MinecraftServerHandle>(
packets::ProtocolState::Login => { packets::ProtocolState::Login => {
// This block of packet parsing is needed here, so the span with the // This block of packet parsing is needed here, so the span with the
// username is correctly propagated due to the async nature of things // username is correctly propagated due to the async nature of things
let packet = Packet::parse(&mut client_stream).await?; let span = tracing::span!(
tracing::Level::INFO,
"login_username_extract",
server_addr = handshake.get_server_address(),
server_port = handshake.server_port.get_value()
);
let packet = Packet::parse(&mut client_stream)
.instrument(span.clone())
.await?;
let login_packet = packets::serverbound::login::LoginStart::parse(packet) let login_packet = packets::serverbound::login::LoginStart::parse(packet)
.instrument(span.clone())
.await .await
.ok_or("Failed to parse login start packet".to_string())?; .ok_or("Failed to parse login start packet".to_string())?;
handle_login(&mut client_stream, &handshake, login_packet, api).await? handle_login(&mut client_stream, &handshake, login_packet, api).await?