summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpp/src/qpid/client/ClientChannel.cpp22
-rw-r--r--cpp/src/qpid/client/ClientChannel.h9
-rw-r--r--cpp/src/qpid/client/Connection.h3
3 files changed, 12 insertions, 22 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;
}
diff --git a/cpp/src/qpid/client/ClientChannel.h b/cpp/src/qpid/client/ClientChannel.h
index 5feba6262f..bf5e2aa0d9 100644
--- a/cpp/src/qpid/client/ClientChannel.h
+++ b/cpp/src/qpid/client/ClientChannel.h
@@ -76,9 +76,6 @@ class Channel : private sys::Runnable
const bool transactional;
framing::ProtocolVersion version;
- uint16_t errorCode;
- std::string errorText;
-
sys::Mutex stopLock;
bool running;
@@ -120,13 +117,11 @@ class Channel : private sys::Runnable
void open(ConnectionImpl::shared_ptr, SessionCore::shared_ptr);
void closeInternal();
- void peerClose(uint16_t, const std::string&);
+ void join();
// FIXME aconway 2007-02-23: Get rid of friendships.
friend class Connection;
- friend class BasicMessageChannel; // for sendAndReceive.
- friend class MessageMessageChannel; // for sendAndReceive.
-
+
public:
/**
* Creates a channel object.
diff --git a/cpp/src/qpid/client/Connection.h b/cpp/src/qpid/client/Connection.h
index 6f58986f25..e2e83c8caf 100644
--- a/cpp/src/qpid/client/Connection.h
+++ b/cpp/src/qpid/client/Connection.h
@@ -59,9 +59,6 @@ class Connection
ConnectionImpl::shared_ptr impl;
bool isOpen;
bool debug;
-
- // TODO aconway 2007-01-26: too many friendships, untagle these classes.
- friend class Channel;
public:
/**