diff options
-rw-r--r-- | qpid/cpp/src/qpid/sys/DispatchHandle.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/qpid/cpp/src/qpid/sys/DispatchHandle.cpp b/qpid/cpp/src/qpid/sys/DispatchHandle.cpp index 95da87aa28..554fc382ed 100644 --- a/qpid/cpp/src/qpid/sys/DispatchHandle.cpp +++ b/qpid/cpp/src/qpid/sys/DispatchHandle.cpp @@ -20,6 +20,7 @@ */ #include "qpid/sys/DispatchHandle.h" +#include "qpid/log/Statement.h" #include <algorithm> @@ -273,6 +274,7 @@ void DispatchHandle::processEvent(Poller::EventType type) { // Do callbacks - whilst we are doing the callbacks we are prevented from processing // the same handle until we re-enable it. To avoid rentering the callbacks for a single // handle re-enabling in the callbacks is actually deferred until they are complete. + try { switch (type) { case Poller::READABLE: readableCallback(*this); @@ -307,6 +309,11 @@ void DispatchHandle::processEvent(Poller::EventType type) { cb(*this); callbacks.pop(); } + } catch (std::exception& e) { + // One of the callbacks threw an exception - that's not allowed + QPID_LOG(error, "Caught exception in state: " << state << " with event: " << type << ": " << e.what()); + // It would be nice to clean up and delete ourselves here, but we can't + } { ScopedLock<Mutex> lock(stateLock); |