diff options
| author | Alan Conway <aconway@apache.org> | 2008-10-03 20:56:38 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2008-10-03 20:56:38 +0000 |
| commit | ff5c8a9034026a6d3ae437fa89c9f3cb9a1ba022 (patch) | |
| tree | d8109d15ce3a85a9b6175ba2c9b3c51d8706fe9c /cpp/src/qpid/client | |
| parent | 2141967346b884e592a42353ae596d37eb90fe7b (diff) | |
| download | qpid-python-ff5c8a9034026a6d3ae437fa89c9f3cb9a1ba022.tar.gz | |
Cluster join & brain-dumps working.
cluster: improved join protocol, fixed race conditions.
client/ConnectionHandler,ConnectionImpl: fixed connection close race causing client hang.
src/qpid/sys/PollableQueue.h: fixed incorrect use of startWatch/stopWatch.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@701532 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client')
| -rw-r--r-- | cpp/src/qpid/client/ConnectionHandler.cpp | 4 | ||||
| -rw-r--r-- | cpp/src/qpid/client/ConnectionHandler.h | 1 | ||||
| -rw-r--r-- | cpp/src/qpid/client/ConnectionImpl.cpp | 8 |
3 files changed, 9 insertions, 4 deletions
diff --git a/cpp/src/qpid/client/ConnectionHandler.cpp b/cpp/src/qpid/client/ConnectionHandler.cpp index 0321c2e6aa..7f1cd5ce7f 100644 --- a/cpp/src/qpid/client/ConnectionHandler.cpp +++ b/cpp/src/qpid/client/ConnectionHandler.cpp @@ -198,5 +198,7 @@ bool ConnectionHandler::isOpen() const bool ConnectionHandler::isClosed() const { int s = getState(); - return s == CLOSING || s == CLOSED || s == FAILED; + return s == CLOSED || s == FAILED; } + +bool ConnectionHandler::isClosing() const { return getState() == CLOSING; } diff --git a/cpp/src/qpid/client/ConnectionHandler.h b/cpp/src/qpid/client/ConnectionHandler.h index ffb612fae8..40be3a5237 100644 --- a/cpp/src/qpid/client/ConnectionHandler.h +++ b/cpp/src/qpid/client/ConnectionHandler.h @@ -99,6 +99,7 @@ public: // Note that open and closed aren't related by open = !closed bool isOpen() const; bool isClosed() const; + bool isClosing() const; CloseListener onClose; ErrorListener onError; diff --git a/cpp/src/qpid/client/ConnectionImpl.cpp b/cpp/src/qpid/client/ConnectionImpl.cpp index f180c4f23e..d9ac65c1b3 100644 --- a/cpp/src/qpid/client/ConnectionImpl.cpp +++ b/cpp/src/qpid/client/ConnectionImpl.cpp @@ -143,11 +143,13 @@ static const std::string CONN_CLOSED("Connection closed by broker"); void ConnectionImpl::shutdown() { Mutex::ScopedLock l(lock); - // FIXME aconway 2008-06-06: exception use, connection-forced is incorrect here. - setException(new ConnectionException(CLOSE_CODE_CONNECTION_FORCED, CONN_CLOSED)); if (handler.isClosed()) return; + // FIXME aconway 2008-06-06: exception use, amqp0-10 does not seem to have + // an appropriate close-code. connection-forced is not right. + if (!handler.isClosing()) + closeInternal(boost::bind(&SessionImpl::connectionBroke, _1, CLOSE_CODE_CONNECTION_FORCED, CONN_CLOSED)); + setException(new ConnectionException(CLOSE_CODE_CONNECTION_FORCED, CONN_CLOSED)); handler.fail(CONN_CLOSED); - closeInternal(boost::bind(&SessionImpl::connectionBroke, _1, CLOSE_CODE_CONNECTION_FORCED, CONN_CLOSED)); } void ConnectionImpl::erase(uint16_t ch) { |
