Merge pull request #7849 from Icinga/bugfix/jsonrpcconnection-sendmessage-keepalive

JsonRpcConnection#Send*Message(): keep this alive
This commit is contained in:
Noah Hilverling 2020-03-02 10:45:46 +01:00 committed by GitHub
commit 984c0ef645
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -170,12 +170,16 @@ ConnectionRole JsonRpcConnection::GetRole() const
void JsonRpcConnection::SendMessage(const Dictionary::Ptr& message)
{
m_IoStrand.post([this, message]() { SendMessageInternal(message); });
Ptr keepAlive (this);
m_IoStrand.post([this, keepAlive, message]() { SendMessageInternal(message); });
}
void JsonRpcConnection::SendRawMessage(const String& message)
{
m_IoStrand.post([this, message]() {
Ptr keepAlive (this);
m_IoStrand.post([this, keepAlive, message]() {
m_OutgoingMessagesQueue.emplace_back(message);
m_OutgoingMessagesQueued.Set();
});