Maintain outgoing bytes queued count

This commit is contained in:
2025-08-24 11:04:26 -04:00
parent c0242317ed
commit e56cf41a01
2 changed files with 18 additions and 6 deletions

View File

@@ -43,6 +43,7 @@ void Connection::appendMessage(std::string_view s, bool copy_to_arena) {
} else {
messages_.push_back(s);
}
outgoing_bytes_queued_ += s.size();
}
int Connection::readBytes(char *buf, size_t buffer_size) {
@@ -104,6 +105,7 @@ bool Connection::writeBytes() {
// Handle partial writes by updating string_view data/size
size_t bytes_written = static_cast<size_t>(w);
outgoing_bytes_queued_ -= bytes_written;
while (bytes_written > 0 && !messages_.empty()) {
auto &front = messages_.front();