From 16b29b1d085070130fc8cf851a4eb33c2f06adda Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Mon, 6 Aug 2007 13:55:08 +0000 Subject: Channel dispatcher needs ti be joined on destruction. Also minor cleanup: removed redundant method and friend declarations. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@563136 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/client/ClientChannel.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'cpp/src/qpid/client/ClientChannel.cpp') diff --git a/cpp/src/qpid/client/ClientChannel.cpp b/cpp/src/qpid/client/ClientChannel.cpp index f407b5a2f9..9eca2903cc 100644 --- a/cpp/src/qpid/client/ClientChannel.cpp +++ b/cpp/src/qpid/client/ClientChannel.cpp @@ -49,11 +49,14 @@ const std::string empty; }} Channel::Channel(bool _transactional, u_int16_t _prefetch) : - prefetch(_prefetch), transactional(_transactional), errorCode(200), errorText("Ok"), running(false) + prefetch(_prefetch), transactional(_transactional), running(false) { } -Channel::~Channel(){} +Channel::~Channel() +{ + join(); +} void Channel::open(ConnectionImpl::shared_ptr c, SessionCore::shared_ptr s) { @@ -145,15 +148,6 @@ void Channel::close() stop(); } -// Channel closed by peer. -void Channel::peerClose(uint16_t code, const std::string& message) { - assert(isOpen()); - //record reason: - errorCode = code; - errorText = message; - stop(); -} - AMQMethodBody::shared_ptr Channel::sendAndReceive(AMQMethodBody::shared_ptr toSend, ClassId /*c*/, MethodId /*m*/) { session->setSync(true); @@ -254,8 +248,12 @@ void Channel::start(){ void Channel::stop() { session->stop(); gets.close(); + join(); +} + +void Channel::join() { Mutex::ScopedLock l(stopLock); - if(running) { + if(running && dispatcher.id()) { dispatcher.join(); running = false; } -- cgit v1.2.1