mirror of https://github.com/Icinga/icinga2.git
Merge pull request #7445 from Icinga/bugfix/ddos-reconnect-7444
JsonRpcConnection#Disconnect(): unregister the connection ASAP
This commit is contained in:
commit
5ed91098d2
|
@ -200,6 +200,16 @@ void JsonRpcConnection::Disconnect()
|
|||
Log(LogWarning, "JsonRpcConnection")
|
||||
<< "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_WriterDone.Wait(yc);
|
||||
|
@ -221,15 +231,6 @@ void JsonRpcConnection::Disconnect()
|
|||
|
||||
m_CheckLivenessTimer.cancel();
|
||||
m_HeartbeatTimer.cancel();
|
||||
|
||||
CpuBoundWork removeClient (yc);
|
||||
|
||||
if (m_Endpoint) {
|
||||
m_Endpoint->RemoveClient(this);
|
||||
} else {
|
||||
auto listener (ApiListener::GetInstance());
|
||||
listener->RemoveAnonymousClient(this);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue