summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/cluster/PollerDispatch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/cluster/PollerDispatch.cpp')
-rw-r--r--cpp/src/qpid/cluster/PollerDispatch.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/cpp/src/qpid/cluster/PollerDispatch.cpp b/cpp/src/qpid/cluster/PollerDispatch.cpp
index b8d94b95a5..43c171efe8 100644
--- a/cpp/src/qpid/cluster/PollerDispatch.cpp
+++ b/cpp/src/qpid/cluster/PollerDispatch.cpp
@@ -37,9 +37,11 @@ PollerDispatch::PollerDispatch(Cpg& c, boost::shared_ptr<sys::Poller> p,
started(false)
{}
-PollerDispatch::~PollerDispatch() {
- if (started)
- dispatchHandle.stopWatch();
+PollerDispatch::~PollerDispatch() { stop(); }
+
+void PollerDispatch::stop() {
+ if (started) dispatchHandle.stopWatch();
+ started = false;
}
void PollerDispatch::start() {
@@ -54,6 +56,7 @@ void PollerDispatch::dispatch(sys::DispatchHandle& h) {
h.rewatch();
} catch (const std::exception& e) {
QPID_LOG(critical, "Error in cluster dispatch: " << e.what());
+ stop();
onError();
}
}