You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2009/05/04 23:29:41 UTC
svn commit: r771452 - in /qpid/trunk/qpid:
cpp/src/qpid/client/ConnectionImpl.cpp cpp/src/qpid/client/ConnectionImpl.h
python/qpid/connection.py
Author: aconway
Date: Mon May 4 21:29:41 2009
New Revision: 771452
URL: http://svn.apache.org/viewvc?rev=771452&view=rev
Log:
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.
Modified:
qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp
qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.h
qpid/trunk/qpid/python/qpid/connection.py
Modified: qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp?rev=771452&r1=771451&r2=771452&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.cpp Mon May 4 21:29:41 2009
@@ -32,6 +32,7 @@
#include <boost/bind.hpp>
#include <boost/format.hpp>
+#include <limits>
namespace qpid {
namespace client {
@@ -81,6 +82,8 @@
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 @@
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()));
Modified: qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.h?rev=771452&r1=771451&r2=771452&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/client/ConnectionImpl.h Mon May 4 21:29:41 2009
@@ -53,6 +53,8 @@
{
typedef std::map<uint16_t, boost::weak_ptr<SessionImpl> > SessionMap;
+ static const uint16_t NEXT_CHANNEL;
+
SessionMap sessions;
ConnectionHandler handler;
boost::scoped_ptr<Connector> connector;
@@ -80,8 +82,8 @@
void open();
bool isOpen() const;
- boost::shared_ptr<SessionImpl> newSession(const std::string& name, uint32_t timeout, uint16_t channel=0);
- void addSession(const boost::shared_ptr<SessionImpl>&, uint16_t channel=0);
+ boost::shared_ptr<SessionImpl> newSession(const std::string& name, uint32_t timeout, uint16_t channel=NEXT_CHANNEL);
+ void addSession(const boost::shared_ptr<SessionImpl>&, uint16_t channel=NEXT_CHANNEL);
void close();
void handle(framing::AMQFrame& frame);
Modified: qpid/trunk/qpid/python/qpid/connection.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/connection.py?rev=771452&r1=771451&r2=771452&view=diff
==============================================================================
--- qpid/trunk/qpid/python/qpid/connection.py (original)
+++ qpid/trunk/qpid/python/qpid/connection.py Mon May 4 21:29:41 2009
@@ -123,8 +123,7 @@
self.lock.release()
def __channel(self):
- # XXX: ch 0?
- for i in xrange(self.channel_max):
+ for i in xrange(1, self.channel_max):
if not self.attached.has_key(i):
return i
else:
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org