diff --git a/base/application.cpp b/base/application.cpp index 20ba6561c..aab9f8e8f 100644 --- a/base/application.cpp +++ b/base/application.cpp @@ -125,13 +125,13 @@ void Application::RunEventLoop(void) int fd = socket->GetFD(); - if (FD_ISSET(fd, &writefds)) + if (FD_ISSET(fd, &writefds) && socket->GetFD() != INVALID_SOCKET) socket->OnWritable(ea); - if (FD_ISSET(fd, &readfds)) + if (FD_ISSET(fd, &readfds) && socket->GetFD() != INVALID_SOCKET) socket->OnReadable(ea); - if (FD_ISSET(fd, &exceptfds)) + if (FD_ISSET(fd, &exceptfds) && socket->GetFD() != INVALID_SOCKET) socket->OnException(ea); } } diff --git a/icinga/jsonrpcendpoint.cpp b/icinga/jsonrpcendpoint.cpp index ee19dad82..c6019d920 100644 --- a/icinga/jsonrpcendpoint.cpp +++ b/icinga/jsonrpcendpoint.cpp @@ -97,7 +97,7 @@ int JsonRpcEndpoint::ClientClosedHandler(const EventArgs& ea) ClearMethodSinks(); ClearMethodSources(); - if (CountMethodSinks() == 0) + if (CountMethodSinks() == 0 && !m_ReconnectTimer) GetEndpointManager()->UnregisterEndpoint(static_pointer_cast(shared_from_this())); m_Client.reset();