summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/client/ConnectionImpl.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2009-05-04 21:29:41 +0000
committerAlan Conway <aconway@apache.org>2009-05-04 21:29:41 +0000
commit3c20c531712c067b040320d2fc48af915c8de112 (patch)
treeb78e07eed9fa2bf9f5412ccdc6eb3ae772f253a4 /cpp/src/qpid/client/ConnectionImpl.cpp
parent5a769bdde526fa83c317ad4feb7d9ac0351eeea9 (diff)
downloadqpid-python-3c20c531712c067b040320d2fc48af915c8de112.tar.gz
Fix issue with python clients to cluster, mis handling of channel 0.
cpp/src/qpid/client/ConnectionImpl.cpp: allow 0 as a valid channel identifier. python/qpid/connection.py: don't use 0 as a channel identifier. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@771452 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/ConnectionImpl.cpp')
-rw-r--r--cpp/src/qpid/client/ConnectionImpl.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/cpp/src/qpid/client/ConnectionImpl.cpp b/cpp/src/qpid/client/ConnectionImpl.cpp
index b1e83025ab..6639f92324 100644
--- a/cpp/src/qpid/client/ConnectionImpl.cpp
+++ b/cpp/src/qpid/client/ConnectionImpl.cpp
@@ -32,6 +32,7 @@
#include <boost/bind.hpp>
#include <boost/format.hpp>
+#include <limits>
namespace qpid {
namespace client {
@@ -81,6 +82,8 @@ ConnectionImpl::ConnectionImpl(framing::ProtocolVersion v, const ConnectionSetti
handler.onError = boost::bind(&ConnectionImpl::closed, this, _1, _2);
}
+const uint16_t ConnectionImpl::NEXT_CHANNEL = std::numeric_limits<uint16_t>::max();
+
ConnectionImpl::~ConnectionImpl() {
// Important to close the connector first, to ensure the
// connector thread does not call on us while the destructor
@@ -92,7 +95,7 @@ ConnectionImpl::~ConnectionImpl() {
void ConnectionImpl::addSession(const boost::shared_ptr<SessionImpl>& session, uint16_t channel)
{
Mutex::ScopedLock l(lock);
- session->setChannel(channel ? channel : nextChannel++);
+ session->setChannel(channel == NEXT_CHANNEL ? nextChannel++ : channel);
boost::weak_ptr<SessionImpl>& s = sessions[session->getChannel()];
boost::shared_ptr<SessionImpl> ss = s.lock();
if (ss) throw SessionBusyException(QPID_MSG("Channel " << ss->getChannel() << " attached to " << ss->getId()));