diff options
Diffstat (limited to 'cpp/src/qpid/client/ClientChannel.cpp')
-rw-r--r-- | cpp/src/qpid/client/ClientChannel.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
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; } |