mirror of
https://github.com/esphome/esphome.git
synced 2026-09-15 00:58:40 +00:00
[api] Use buf_start directly in noise write_protobuf_packet, add flow comment
This commit is contained in:
@@ -142,6 +142,7 @@ APIError APIFrameHelper::write_raw_iov_(const struct iovec *iov, int iovcnt, uin
|
||||
(iovcnt == 1) ? this->socket_->write(iov[0].iov_base, iov[0].iov_len) : this->socket_->writev(iov, iovcnt);
|
||||
if (sent == static_cast<ssize_t>(total_write_len))
|
||||
return APIError::OK;
|
||||
// Partial write or -1: fall through to error check / enqueue below
|
||||
}
|
||||
}
|
||||
if (sent == -1) {
|
||||
|
||||
@@ -504,7 +504,8 @@ APIError APINoiseFrameHelper::write_protobuf_packet(uint8_t type, ProtoWriteBuff
|
||||
APIError aerr = this->encrypt_noise_message_(buf_start, msg, iov);
|
||||
if (aerr != APIError::OK)
|
||||
return aerr;
|
||||
return this->write_raw_fast_buf_(iov.iov_base, static_cast<uint16_t>(iov.iov_len));
|
||||
// buf_start and iov.iov_base point to the same location
|
||||
return this->write_raw_fast_buf_(buf_start, static_cast<uint16_t>(iov.iov_len));
|
||||
}
|
||||
|
||||
APIError APINoiseFrameHelper::write_protobuf_messages(ProtoWriteBuffer buffer, std::span<const MessageInfo> messages) {
|
||||
|
||||
Reference in New Issue
Block a user