chore(snownet): log channel number and peer as part of failed channel binding (#4086)

Should help in debugging which channel we tried to bind without having
to sieve through the relay's logs for the transaction ID.
This commit is contained in:
Thomas Eizinger
2024-03-12 21:12:50 +11:00
committed by GitHub
parent 407d20d817
commit 066ed4c85d

View File

@@ -238,8 +238,19 @@ impl Allocation {
tracing::warn!("Request did not contain a `CHANNEL-NUMBER`");
return true;
};
let Some(peer) = original_request
.get_attribute::<XorPeerAddress>()
.map(|c| c.address())
else {
tracing::warn!("Request did not contain a `XOR-PEER-ADDRESS`");
return true;
};
self.channel_bindings.handle_failed_binding(channel);
// Duplicate log here because we want to attach "channel number" and "peer".
tracing::warn!(error = %error.reason_phrase(), %channel, %peer);
return true;
}
REFRESH => {
self.invalidate_allocation();
@@ -248,10 +259,7 @@ impl Allocation {
_ => {}
}
// TODO: Handle error codes such as:
// - Failed allocations
tracing::warn!(error = %error.reason_phrase(), "STUN request failed");
tracing::warn!(error = %error.reason_phrase());
return true;
}