summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2007-08-06 13:55:08 +0000
committerGordon Sim <gsim@apache.org>2007-08-06 13:55:08 +0000
commit16b29b1d085070130fc8cf851a4eb33c2f06adda (patch)
treeeb3cfc886257677740597f82f0def0a39dc40082 /cpp/src
parente69ee09777dad5a4889fa71a77a6610ac827f9bc (diff)
downloadqpid-python-16b29b1d085070130fc8cf851a4eb33c2f06adda.tar.gz
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
Diffstat (limited to 'cpp/src')
-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:
/**