From 4fbdc50fe0b03ae03fd678c1146c06ae4809801c Mon Sep 17 00:00:00 2001 From: Arcao Date: Mon, 12 Oct 2026 11:27:33 +0200 Subject: [PATCH] Return false from log/logf when the packet could not be sent _sendLog ignored the result of UDP::endPacket() and always returned true, so a packet dropped by the network stack (e.g. full ARP queue on ESP32) was reported as sent. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_015dqPaWXEZmNHreFax2RpKq --- src/Syslog.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Syslog.cpp b/src/Syslog.cpp index 5782c10..48f83ca 100644 --- a/src/Syslog.cpp +++ b/src/Syslog.cpp @@ -236,9 +236,10 @@ inline bool Syslog::_sendLog(uint16_t pri, const char *message) { this->_client->print(F("[0]: ")); } this->_client->print(message); - this->_client->endPacket(); - return true; + // endPacket returns 1 on success, 0 on failure (e.g. a packet dropped by the + // network stack) + return this->_client->endPacket() > 0; } inline bool Syslog::_sendLog(uint16_t pri, const __FlashStringHelper *message) { @@ -282,8 +283,8 @@ inline bool Syslog::_sendLog(uint16_t pri, const __FlashStringHelper *message) { this->_client->print(F("[0]: ")); } this->_client->print(message); - this->_client->endPacket(); - - return true; + // endPacket returns 1 on success, 0 on failure (e.g. a packet dropped by the + // network stack) + return this->_client->endPacket() > 0; }