From c47fb9a80ab98ed1ebb53b39ff7b9447e16a14b7 Mon Sep 17 00:00:00 2001 From: reverse Date: Wed, 19 Aug 2026 01:34:24 +0000 Subject: [PATCH] syslog: keep the UDP socket cached across send errors instead of dropping it (which re-bound + re-resolved a socket on every notice when the target was unreachable); the Unix datagram path still reopens on failure --- src/modules/syslog.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/modules/syslog.rs b/src/modules/syslog.rs index db329c8..10f7f42 100644 --- a/src/modules/syslog.rs +++ b/src/modules/syslog.rs @@ -103,10 +103,15 @@ pub fn tee(s: &Server, msg: &str) { if let Some((_, sink)) = slot.as_ref() { let ok = match sink { Sink::Unix(sock) => sock.send(line.as_bytes()).is_ok(), - Sink::Udp(sock, dst) => sock.send_to(line.as_bytes(), dst).is_ok(), + Sink::Udp(sock, dst) => { + // UDP is fire-and-forget: a transient send error shouldn't force a + // re-bind + re-resolve on the very next notice. Keep the socket. + let _ = sock.send_to(line.as_bytes(), dst); + true + } }; if !ok { - *slot = None; // transient failure: drop so we reopen next time + *slot = None; // (Unix datagram socket only) reopen next time } } });