diff options
author | Gordon Sim <gsim@apache.org> | 2011-06-09 12:24:48 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2011-06-09 12:24:48 +0000 |
commit | c8c7bcaa46eb47a249c6e05546253e462e705cab (patch) | |
tree | 13c5f6ba08d21beabdd6bf1ec8c39c6e0b890a72 /cpp/src | |
parent | a78bc3c162a429877b53ec069cfc5ff013d8de1f (diff) | |
download | qpid-python-c8c7bcaa46eb47a249c6e05546253e462e705cab.tar.gz |
QPID-3292: Don't try to reconnect at all if reconnect option is false
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1133822 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp | 11 | ||||
-rw-r--r-- | cpp/src/qpid/client/amqp0_10/ConnectionImpl.h | 1 | ||||
-rw-r--r-- | cpp/src/qpid/client/amqp0_10/SessionImpl.cpp | 2 |
3 files changed, 12 insertions, 2 deletions
diff --git a/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp b/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp index a87a8dea67..345534b1c2 100644 --- a/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp +++ b/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp @@ -198,7 +198,7 @@ qpid::messaging::Session ConnectionImpl::newSession(bool transactional, const st sessions[name] = impl; break; } catch (const qpid::TransportFailure&) { - open(); + reopen(); } catch (const qpid::SessionException& e) { throw qpid::messaging::SessionError(e.what()); } catch (const std::exception& e) { @@ -219,6 +219,15 @@ void ConnectionImpl::open() catch (const qpid::Exception& e) { throw messaging::ConnectionError(e.what()); } } +void ConnectionImpl::reopen() +{ + if (!reconnect) { + throw qpid::messaging::TransportFailure("Failed to connect (reconnect disabled)"); + } + open(); +} + + bool expired(const qpid::sys::AbsTime& start, int64_t timeout) { if (timeout == 0) return true; diff --git a/cpp/src/qpid/client/amqp0_10/ConnectionImpl.h b/cpp/src/qpid/client/amqp0_10/ConnectionImpl.h index 09f2038312..9e31238bc1 100644 --- a/cpp/src/qpid/client/amqp0_10/ConnectionImpl.h +++ b/cpp/src/qpid/client/amqp0_10/ConnectionImpl.h @@ -43,6 +43,7 @@ class ConnectionImpl : public qpid::messaging::ConnectionImpl public: ConnectionImpl(const std::string& url, const qpid::types::Variant::Map& options); void open(); + void reopen(); bool isOpen() const; void close(); qpid::messaging::Session newSession(bool transactional, const std::string& name); diff --git a/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp b/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp index 75a71997fd..9e43e70f32 100644 --- a/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp +++ b/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp @@ -509,7 +509,7 @@ void SessionImpl::senderCancelled(const std::string& name) void SessionImpl::reconnect() { - connection->open(); + connection->reopen(); } bool SessionImpl::backoff() |