Single enqueue_or_fail_ tail call in write_raw_

This commit is contained in:
J. Nick Koston
2026-03-16 12:31:36 -10:00
parent 1a3c477998
commit 5bee336a76
+2 -1
View File
@@ -120,10 +120,11 @@ APIError APIFrameHelper::write_raw_(const struct iovec *iov, int iovcnt, uint16_
if (this->check_socket_write_err_(errno) != APIError::WOULD_BLOCK)
return APIError::SOCKET_WRITE_FAILED;
}
// If drain didn't fully clear, skip direct send and queue behind backlog
}
// If no backlog (either drained or was empty), try to send directly
if (this->overflow_buf_.empty()) {
// No backlog — try to send directly
// Optimize for single iovec case (common for plaintext API)
ssize_t sent =
(iovcnt == 1) ? this->socket_->write(iov[0].iov_base, iov[0].iov_len) : this->socket_->writev(iov, iovcnt);