From ce9bc3aaa12968095fe3d1392420a84a8f14331b Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 29 Mar 2026 11:00:42 -1000 Subject: [PATCH] [api] Use iovec path for write_frame_ to avoid inlining write_raw_ in cold handshake code --- esphome/components/api/api_frame_helper_noise.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/esphome/components/api/api_frame_helper_noise.cpp b/esphome/components/api/api_frame_helper_noise.cpp index 0471713c54..e78f021743 100644 --- a/esphome/components/api/api_frame_helper_noise.cpp +++ b/esphome/components/api/api_frame_helper_noise.cpp @@ -539,12 +539,12 @@ APIError APINoiseFrameHelper::write_frame_(const uint8_t *data, uint16_t len) { header[1] = (uint8_t) (len >> 8); header[2] = (uint8_t) len; - if (len == 0) { - return this->write_raw_(header, 3); // Just header - } struct iovec iov[2]; iov[0].iov_base = header; iov[0].iov_len = 3; + if (len == 0) { + return this->write_raw_(iov, 1, 3); // Just header + } iov[1].iov_base = const_cast(data); iov[1].iov_len = len;