From f600d75930d3d77385512ce81187bafdf0467df3 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 11 Aug 2015 12:08:54 +0200 Subject: [PATCH] Fix crash during cluster log replay fixes #9876 --- lib/remote/apilistener.cpp | 12 +++++++++++- lib/remote/apilistener.hpp | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp index 84b89ad7f..13d32abb6 100644 --- a/lib/remote/apilistener.cpp +++ b/lib/remote/apilistener.cpp @@ -262,12 +262,22 @@ void ApiListener::AddConnection(const Endpoint::Ptr& endpoint) } } +void ApiListener::NewClientHandler(const Socket::Ptr& client, const String& hostname, ConnectionRole role) +{ + try { + NewClientHandler(client, hostname, role); + } catch (const std::exception& ex) { + Log(LogCritical, "ApiListener") + << "Exception while handling new API client connection: " << DiagnosticInformation(ex); + } +} + /** * Processes a new client connection. * * @param client The new client. */ -void ApiListener::NewClientHandler(const Socket::Ptr& client, const String& hostname, ConnectionRole role) +void ApiListener::NewClientHandlerInternal(const Socket::Ptr& client, const String& hostname, ConnectionRole role) { CONTEXT("Handling new API client connection"); diff --git a/lib/remote/apilistener.hpp b/lib/remote/apilistener.hpp index c7fccb38b..9842b5a38 100644 --- a/lib/remote/apilistener.hpp +++ b/lib/remote/apilistener.hpp @@ -93,6 +93,7 @@ private: void AddConnection(const Endpoint::Ptr& endpoint); void NewClientHandler(const Socket::Ptr& client, const String& hostname, ConnectionRole role); + void NewClientHandlerInternal(const Socket::Ptr& client, const String& hostname, ConnectionRole role); void ListenerThreadProc(const Socket::Ptr& server); WorkQueue m_RelayQueue;