diff options
| author | Gordon Sim <gsim@apache.org> | 2008-11-03 17:21:38 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2008-11-03 17:21:38 +0000 |
| commit | a95eb74d7f806e3a60bbd61a042329bcfba9b21d (patch) | |
| tree | 1f300ecd3d7dd2a39fdcd3882fb788b5dce28bf2 /cpp/src/qpid/client/Connector.cpp | |
| parent | c7ed94d2a123f3753a6d64eff5a83b742ce30163 (diff) | |
| download | qpid-python-a95eb74d7f806e3a60bbd61a042329bcfba9b21d.tar.gz | |
Various fixes arising from testing client failover:
* introduced new exception type for signalling connection failure (as distinct from any logical connection errors)
* ConnectionImpl::closeInternal(): take copy of session map to prevent concurrent modification (by the same thread) as sessions are deleted and erase themselves.
* ConnectionImpl::shutdown: hold lock before calling closeInternal(); mark handler failed before informing sessions of failure
* SessionImpl::connectionBroker(): remove code as its rather meaningless
* Don't swallow exceptions in Dispatcher
* Handle exceptions in FailoverListener
* Take weak_ptr to ConnectionImpl on constructor of Connector, then convert to shared_ptr when 'receiver' thread is started.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@710106 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/Connector.cpp')
| -rw-r--r-- | cpp/src/qpid/client/Connector.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cpp/src/qpid/client/Connector.cpp b/cpp/src/qpid/client/Connector.cpp index f7a8d8b853..6509964fe8 100644 --- a/cpp/src/qpid/client/Connector.cpp +++ b/cpp/src/qpid/client/Connector.cpp @@ -35,6 +35,7 @@ #include <map> #include <boost/bind.hpp> #include <boost/format.hpp> +#include <boost/weak_ptr.hpp> namespace qpid { namespace client { @@ -140,7 +141,7 @@ class TCPConnector : public Connector, private sys::Runnable std::string identifier; - ConnectionImpl* impl; + boost::weak_ptr<ConnectionImpl> impl; void connect(const std::string& host, int port); void init(); @@ -183,7 +184,7 @@ TCPConnector::TCPConnector(ProtocolVersion ver, shutdownHandler(0), writer(maxFrameSize, cimpl), aio(0), - impl(cimpl) + impl(cimpl->shared_from_this()) { QPID_LOG(debug, "TCPConnector created for " << version.toString()); settings.configureSocket(socket); @@ -380,7 +381,7 @@ void TCPConnector::eof(AsynchIO&) { // will never be called void TCPConnector::run(){ // Keep the connection impl in memory until run() completes. - boost::shared_ptr<ConnectionImpl> protect = impl->shared_from_this(); + boost::shared_ptr<ConnectionImpl> protect = impl.lock(); assert(protect); try { Dispatcher d(poller); |
