mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 17:05:36 +00:00
Restore HELPER_LOG in write_raw_ error paths
This commit is contained in:
@@ -114,9 +114,11 @@ APIError APIFrameHelper::write_raw_(const struct iovec *iov, int iovcnt, uint16_
|
||||
|
||||
// Drain any existing backlog first
|
||||
if (!this->overflow_buf_.empty()) [[unlikely]] {
|
||||
if (this->overflow_buf_.try_drain(this->socket_.get()) == -1 &&
|
||||
this->check_socket_write_err_(errno) != APIError::WOULD_BLOCK)
|
||||
return APIError::SOCKET_WRITE_FAILED;
|
||||
if (this->overflow_buf_.try_drain(this->socket_.get()) == -1) {
|
||||
HELPER_LOG("Socket write failed with errno %d", errno);
|
||||
if (this->check_socket_write_err_(errno) != APIError::WOULD_BLOCK)
|
||||
return APIError::SOCKET_WRITE_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
// If backlog is clear, try direct send
|
||||
@@ -125,6 +127,7 @@ APIError APIFrameHelper::write_raw_(const struct iovec *iov, int iovcnt, uint16_
|
||||
(iovcnt == 1) ? this->socket_->write(iov[0].iov_base, iov[0].iov_len) : this->socket_->writev(iov, iovcnt);
|
||||
|
||||
if (sent == -1) [[unlikely]] {
|
||||
HELPER_LOG("Socket write failed with errno %d", errno);
|
||||
if (this->check_socket_write_err_(errno) != APIError::WOULD_BLOCK)
|
||||
return APIError::SOCKET_WRITE_FAILED;
|
||||
} else if (static_cast<uint16_t>(sent) >= total_write_len) [[likely]] {
|
||||
|
||||
Reference in New Issue
Block a user