From b017c6b209c82cd5ae594964a3bcfbe1186814e8 Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Tue, 19 Aug 2025 16:04:44 -0400 Subject: [PATCH] We still want to "write" empty messages So that the size of the messages queue can go to zero --- src/connection.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/connection.cpp b/src/connection.cpp index 9d474d6..19a5f58 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -69,17 +69,13 @@ bool Connection::writeBytes() { for (auto it = messages_.begin(); it != messages_.end() && iov_count < IOV_MAX; ++it) { const auto &msg = *it; - if (msg.size() > 0) { - iov[iov_count] = { - const_cast(static_cast(msg.data())), - msg.size()}; - iov_count++; - } + iov[iov_count] = { + const_cast(static_cast(msg.data())), + msg.size()}; + iov_count++; } - if (iov_count == 0) { - break; - } + assert(iov_count > 0); ssize_t w; for (;;) {