mirror of
https://github.com/Icinga/icinga2.git
synced 2025-04-08 17:05:25 +02:00
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:
parent
c3b5dbfbc7
commit
ebf905a220
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user