mirror of https://github.com/Icinga/icinga2.git
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
9a8620d923
commit
aa7f159a0f
|
@ -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…
Reference in New Issue