Merge pull request #7997 from Icinga/bugfix/jsonrpcconnection-handleandwriteheartbeats-m_endpoint-getname

JsonRpcConnection#HandleAndWriteHeartbeats(): check !!#m_Endpoint
This commit is contained in:
Alexander Aleksandrovič Klimov 2020-05-11 11:39:19 +02:00 committed by GitHub
commit 13df2fc067
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,9 +28,17 @@ void JsonRpcConnection::HandleAndWriteHeartbeats(boost::asio::yield_context yc)
}
if (m_NextHeartbeat != 0 && m_NextHeartbeat < Utility::GetTime()) {
Log(LogWarning, "JsonRpcConnection")
<< "Client for endpoint '" << m_Endpoint->GetName() << "' has requested "
<< "heartbeat message but hasn't responded in time. Closing connection.";
{
Log logMsg (LogWarning, "JsonRpcConnection");
if (m_Endpoint) {
logMsg << "Client for endpoint '" << m_Endpoint->GetName() << "'";
} else {
logMsg << "Anonymous client";
}
logMsg << " has requested heartbeat message but hasn't responded in time. Closing connection.";
}
Disconnect();
break;