Bugfix: Connecting to a remote node crashes Icinga2.

This commit is contained in:
Gunnar Beutner 2012-10-11 14:17:40 +02:00
parent a63ef86869
commit 4e5702e31d
1 changed files with 2 additions and 2 deletions

View File

@ -147,8 +147,6 @@ void EndpointManager::NewClientHandler(const TcpClient::Ptr& client)
{ {
JsonRpcClient::Ptr jclient = static_pointer_cast<JsonRpcClient>(client); JsonRpcClient::Ptr jclient = static_pointer_cast<JsonRpcClient>(client);
Logger::Write(LogInformation, "icinga", "New client connection from " + jclient->GetPeerAddress());
m_PendingClients.insert(jclient); m_PendingClients.insert(jclient);
jclient->OnConnected.connect(boost::bind(&EndpointManager::ClientConnectedHandler, this, _1)); jclient->OnConnected.connect(boost::bind(&EndpointManager::ClientConnectedHandler, this, _1));
jclient->Start(); jclient->Start();
@ -158,6 +156,8 @@ void EndpointManager::ClientConnectedHandler(const TcpClient::Ptr& client)
{ {
JsonRpcClient::Ptr jclient = static_pointer_cast<JsonRpcClient>(client); JsonRpcClient::Ptr jclient = static_pointer_cast<JsonRpcClient>(client);
Logger::Write(LogInformation, "icinga", "New client connection for " + jclient->GetPeerAddress());
m_PendingClients.erase(jclient); m_PendingClients.erase(jclient);
shared_ptr<X509> cert = jclient->GetPeerCertificate(); shared_ptr<X509> cert = jclient->GetPeerCertificate();