mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 17:05:36 +00:00
[api] Rename write_raw_slow_ to write_raw_
This commit is contained in:
@@ -115,7 +115,7 @@ APIError APIFrameHelper::drain_overflow_and_handle_errors_() {
|
||||
// Slow path: handles partial writes, errors, and overflow buffering.
|
||||
// Called when the inline fast path in the header couldn't complete the write.
|
||||
// sent == -1 means either the fast path write returned -1, or there was overflow backlog.
|
||||
APIError APIFrameHelper::write_raw_slow_(const struct iovec *iov, int iovcnt, uint16_t total_write_len, ssize_t sent) {
|
||||
APIError APIFrameHelper::write_raw_(const struct iovec *iov, int iovcnt, uint16_t total_write_len, ssize_t sent) {
|
||||
#ifdef HELPER_LOG_PACKETS
|
||||
for (int i = 0; i < iovcnt; i++) {
|
||||
LOG_PACKET_SENDING(reinterpret_cast<uint8_t *>(iov[i].iov_base), iov[i].iov_len);
|
||||
|
||||
@@ -201,7 +201,7 @@ class APIFrameHelper {
|
||||
return APIError::OK;
|
||||
}
|
||||
struct iovec iov = {const_cast<void *>(data), len};
|
||||
return this->write_raw_slow_(&iov, 1, len, sent);
|
||||
return this->write_raw_(&iov, 1, len, sent);
|
||||
}
|
||||
inline APIError ESPHOME_ALWAYS_INLINE write_raw_fast_(const struct iovec *iov, int iovcnt, uint16_t total_write_len) {
|
||||
ssize_t sent = -1;
|
||||
@@ -210,11 +210,11 @@ class APIFrameHelper {
|
||||
if (sent == static_cast<ssize_t>(total_write_len)) [[likely]]
|
||||
return APIError::OK;
|
||||
}
|
||||
return this->write_raw_slow_(iov, iovcnt, total_write_len, sent);
|
||||
return this->write_raw_(iov, iovcnt, total_write_len, sent);
|
||||
}
|
||||
|
||||
// Slow path (out-of-line): handle partial writes, errors, overflow buffering
|
||||
APIError write_raw_slow_(const struct iovec *iov, int iovcnt, uint16_t total_write_len, ssize_t sent);
|
||||
APIError write_raw_(const struct iovec *iov, int iovcnt, uint16_t total_write_len, ssize_t sent);
|
||||
|
||||
// Socket ownership (4 bytes on 32-bit, 8 bytes on 64-bit)
|
||||
std::unique_ptr<socket::Socket> socket_;
|
||||
|
||||
@@ -541,7 +541,7 @@ APIError APINoiseFrameHelper::write_frame_(const uint8_t *data, uint16_t len) {
|
||||
|
||||
if (len == 0) {
|
||||
struct iovec iov = {header, 3};
|
||||
return this->write_raw_slow_(&iov, 1, 3, -1);
|
||||
return this->write_raw_(&iov, 1, 3, -1);
|
||||
}
|
||||
struct iovec iov[2];
|
||||
iov[0].iov_base = header;
|
||||
@@ -549,7 +549,7 @@ APIError APINoiseFrameHelper::write_frame_(const uint8_t *data, uint16_t len) {
|
||||
iov[1].iov_base = const_cast<uint8_t *>(data);
|
||||
iov[1].iov_len = len;
|
||||
|
||||
return this->write_raw_slow_(iov, 2, 3 + len, -1);
|
||||
return this->write_raw_(iov, 2, 3 + len, -1);
|
||||
}
|
||||
|
||||
/** Initiate the data structures for the handshake.
|
||||
|
||||
@@ -220,12 +220,12 @@ APIError APIPlaintextFrameHelper::read_packet(ReadPacketBuffer *buffer) {
|
||||
char msg[INDICATOR_MSG_SIZE];
|
||||
memcpy_P(msg, MSG_PROGMEM, INDICATOR_MSG_SIZE);
|
||||
struct iovec iov = {msg, INDICATOR_MSG_SIZE};
|
||||
this->write_raw_slow_(&iov, 1, INDICATOR_MSG_SIZE, -1);
|
||||
this->write_raw_(&iov, 1, INDICATOR_MSG_SIZE, -1);
|
||||
#else
|
||||
static const char MSG[] = "\x00"
|
||||
"Bad indicator byte";
|
||||
struct iovec iov = {const_cast<char *>(MSG), INDICATOR_MSG_SIZE};
|
||||
this->write_raw_slow_(&iov, 1, INDICATOR_MSG_SIZE, -1);
|
||||
this->write_raw_(&iov, 1, INDICATOR_MSG_SIZE, -1);
|
||||
#endif
|
||||
}
|
||||
return aerr;
|
||||
|
||||
Reference in New Issue
Block a user