JsonRpcConnection: don't write new messages on shutdown

In fact, this is already done for the outer loop (for each bulk), just not yet for the inner one (for each message of a bulk). So once the remote signals EOF, don't try to process the remaining queue until write error (which can't be associated with a particular message anyway, due to buffering), but just let the peer go. Flush already half-written messages, though, if possible.
This commit is contained in:
Alexander Aleksandrovič Klimov 2024-11-07 17:32:12 +01:00 committed by Yonas Habteab
parent c3b5dbfbc7
commit ebf905a220

View File

@ -110,6 +110,10 @@ void JsonRpcConnection::WriteOutgoingMessages(boost::asio::yield_context yc)
if (!queue.empty()) {
try {
for (auto& message : queue) {
if (m_ShuttingDown) {
break;
}
size_t bytesSent = JsonRpc::SendRawMessage(m_Stream, message, yc);
if (m_Endpoint) {