summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/cluster/Quorum_cman.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2010-08-09 19:29:18 +0000
committerAlan Conway <aconway@apache.org>2010-08-09 19:29:18 +0000
commitdb421d82a01e82eae72ff262e632bce92ecf575b (patch)
treef7e2ec1a1b9105c63598d71349772592b054eb86 /cpp/src/qpid/cluster/Quorum_cman.cpp
parentf1492c206ea64eaddb1bece4e83939c1d845b70b (diff)
downloadqpid-python-db421d82a01e82eae72ff262e632bce92ecf575b.tar.gz
Fixed memory management error in cluster::Quorum causing problems with --cluster-cman.
Sometimes caused brokers using --cluster-cman to fail with a "no permission" or "bad file-descriptor" error. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@983786 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/cluster/Quorum_cman.cpp')
-rw-r--r--cpp/src/qpid/cluster/Quorum_cman.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/cpp/src/qpid/cluster/Quorum_cman.cpp b/cpp/src/qpid/cluster/Quorum_cman.cpp
index f7d2c5c409..728f824b16 100644
--- a/cpp/src/qpid/cluster/Quorum_cman.cpp
+++ b/cpp/src/qpid/cluster/Quorum_cman.cpp
@@ -42,7 +42,7 @@ void cmanCallbackFn(cman_handle_t handle, void */*privdata*/, int reason, int /*
}
}
-Quorum::Quorum(boost::function<void()> err) : enable(false), cman(0), cmanFd(0) {
+Quorum::Quorum(boost::function<void()> err) : cman(0), cmanFd(0) {
errorFn = err;
}
@@ -54,7 +54,6 @@ Quorum::~Quorum() {
void Quorum::start(boost::shared_ptr<sys::Poller> p) {
poller = p;
- enable = true;
QPID_LOG(debug, "Connecting to quorum service.");
cman = cman_init(0);
if (cman == 0) throw ErrnoException("Can't connect to cman service");
@@ -70,9 +69,10 @@ void Quorum::start(boost::shared_ptr<sys::Poller> p) {
void Quorum::watch(int fd) {
cmanFd = fd;
if (dispatchHandle.get()) dispatchHandle->stopWatch();
+ ioHandle.reset(new sys::PosixIOHandle(cmanFd));
dispatchHandle.reset(
new sys::DispatchHandleRef(
- sys::PosixIOHandle(cmanFd),
+ *ioHandle, // This must outlive the dispatchHandleRef
boost::bind(&Quorum::dispatch, this, _1), // read
0, // write
boost::bind(&Quorum::disconnect, this, _1) // disconnect