Skip to content

Commit

Permalink
chore: Add source label to QCMP errors (#1120)
Browse files Browse the repository at this point in the history
  • Loading branch information
XAMPPRocky authored Feb 18, 2025
1 parent 6884f20 commit d2f5d24
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/codec/qcmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ pub fn spawn(
continue;
}
Err(error) => {
tracing::debug!(%error, "rejected malformed packet");
tracing::debug!(%error, %source, "rejected malformed packet");
continue;
}
};
Expand All @@ -231,25 +231,26 @@ pub fn spawn(
nonce,
} = command
else {
tracing::warn!("rejected unsupported QCMP packet");
tracing::warn!(%source, "rejected unsupported QCMP packet");
continue;
};

Protocol::ping_reply(nonce, client_timestamp, received_at)
.encode(&mut output_buf);

tracing::debug!(
%source,
"sending QCMP pong",
);

match socket.send_to(&output_buf, source).await {
Ok(len) => {
if len != output_buf.len() {
tracing::error!("failed to send entire QCMP pong response, expected {} but only sent {len}", output_buf.len());
tracing::error!(%source, "failed to send entire QCMP pong response, expected {} but only sent {len}", output_buf.len());
}
}
Err(error) => {
tracing::warn!(%error, "error responding to ping");
tracing::warn!(%error, %source, "error responding to ping");
}
}
}
Expand Down

0 comments on commit d2f5d24

Please sign in to comment.