mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 22:54:57 +02:00
JsonRpcConnection#Disconnect(): unregister the connection ASAP
refs #7444
This commit is contained in:
parent
8c739fe33b
commit
c24312b870
@ -200,6 +200,16 @@ void JsonRpcConnection::Disconnect()
|
|||||||
Log(LogWarning, "JsonRpcConnection")
|
Log(LogWarning, "JsonRpcConnection")
|
||||||
<< "API client disconnected for identity '" << m_Identity << "'";
|
<< "API client disconnected for identity '" << m_Identity << "'";
|
||||||
|
|
||||||
|
{
|
||||||
|
CpuBoundWork removeClient (yc);
|
||||||
|
|
||||||
|
if (m_Endpoint) {
|
||||||
|
m_Endpoint->RemoveClient(this);
|
||||||
|
} else {
|
||||||
|
ApiListener::GetInstance()->RemoveAnonymousClient(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_OutgoingMessagesQueued.Set();
|
m_OutgoingMessagesQueued.Set();
|
||||||
|
|
||||||
m_WriterDone.Wait(yc);
|
m_WriterDone.Wait(yc);
|
||||||
@ -221,15 +231,6 @@ void JsonRpcConnection::Disconnect()
|
|||||||
|
|
||||||
m_CheckLivenessTimer.cancel();
|
m_CheckLivenessTimer.cancel();
|
||||||
m_HeartbeatTimer.cancel();
|
m_HeartbeatTimer.cancel();
|
||||||
|
|
||||||
CpuBoundWork removeClient (yc);
|
|
||||||
|
|
||||||
if (m_Endpoint) {
|
|
||||||
m_Endpoint->RemoveClient(this);
|
|
||||||
} else {
|
|
||||||
auto listener (ApiListener::GetInstance());
|
|
||||||
listener->RemoveAnonymousClient(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user