From bafc57f02ec3d2bc4ba1d381fb82a819a62ca4b8 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 15 May 2025 03:06:36 -0500 Subject: [PATCH] fix refactoring error --- esphome/components/api/api_frame_helper.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/esphome/components/api/api_frame_helper.cpp b/esphome/components/api/api_frame_helper.cpp index 73efc55824..82ebd531f6 100644 --- a/esphome/components/api/api_frame_helper.cpp +++ b/esphome/components/api/api_frame_helper.cpp @@ -283,7 +283,10 @@ APIError APINoiseFrameHelper::loop() { return err; if (this->tx_buf_.empty()) return APIError::OK; - return try_send_tx_buf_(); + err = try_send_tx_buf_(); + if (err == APIError::WOULD_BLOCK) + return APIError::OK; // Convert WOULD_BLOCK to OK to avoid connection termination + return err; } /** Read a packet into the rx_buf_. If successful, stores frame data in the frame parameter @@ -802,7 +805,10 @@ APIError APIPlaintextFrameHelper::loop() { } if (this->tx_buf_.empty()) return APIError::OK; - return try_send_tx_buf_(); + APIError err = try_send_tx_buf_(); + if (err == APIError::WOULD_BLOCK) + return APIError::OK; // Convert WOULD_BLOCK to OK to avoid connection termination + return err; } /** Read a packet into the rx_buf_. If successful, stores frame data in the frame parameter