Log inbound handshake rejections at debug, not warn

Creating and leaving networks produced a stream of WARN lines like "Handshake
rejected: peer requested an unknown or inactive network network=None". This is
not a leave bug: leaving deactivates the network and publishes a release, but
remote peers that still consider this device a member keep dialing, and each
dial for a network no longer served is correctly rejected by the responder
(lookup returns None, so the network stays unidentified — network=None by
design, since a pre-handshake claim is unverified).

Such a rejection is routine and remotely triggerable — a left network a peer
has not caught up on, a stranger, a port scan, an old client — so logging it at
WARN let any peer spam the log. It is now debug; enable debug to see rejections
when diagnosing. The rejection behaviour itself is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
UltradesuandClaude Opus 4.8 committed 2026-10-02 15:27:49 +01:00
1 parent d1de61ba29
commit 2cda56e1f8
1 file changed
+6 -1
+6 -1
View File
@@ -4435,7 +4435,12 @@ fn log_event(event: &Event) {
let peer_str = peer
.map(|p| p.fmt_short().to_string())
.unwrap_or_else(|| "unknown".into());
tracing::warn!(
// Routine and remotely triggerable: a peer dialing a network this
// agent does not serve — one it never had, or has left and the peer
// has not learned yet — a stranger, or an old client. Rejecting is
// correct and contained (one session), so this is debug rather than
// a warning any peer could spam into the log.
tracing::debug!(
network = ?network.map(|n| n.fmt_short().to_string()),
peer = %peer_str,
"Handshake rejected: {reason}"