diff options
author | Alan Conway <aconway@apache.org> | 2007-06-27 02:28:30 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2007-06-27 02:28:30 +0000 |
commit | af6a722927f83e72400312471a758f7cdf9acbc3 (patch) | |
tree | 49d3591906c967ebc5d8cc5b5c7edf6dd3749cf8 /cpp/src | |
parent | 93ac8958d4561b6b3e520b181abc859eb5428edd (diff) | |
download | qpid-python-af6a722927f83e72400312471a758f7cdf9acbc3.tar.gz |
Fixed client leak and python tests port
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@551014 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/client/Connector.cpp | 35 | ||||
-rw-r--r-- | cpp/src/qpid/client/Connector.h | 2 | ||||
-rwxr-xr-x | cpp/src/tests/python_tests | 2 |
3 files changed, 19 insertions, 20 deletions
diff --git a/cpp/src/qpid/client/Connector.cpp b/cpp/src/qpid/client/Connector.cpp index ef7c9ce7fd..17b68c1f6a 100644 --- a/cpp/src/qpid/client/Connector.cpp +++ b/cpp/src/qpid/client/Connector.cpp @@ -47,7 +47,9 @@ Connector::Connector( { } Connector::~Connector(){ - close(); + closeInternal(); + if (receiver.id()) + receiver.join(); } void Connector::connect(const std::string& host, int port){ @@ -62,11 +64,19 @@ void Connector::init(){ writeBlock(&init); } -void Connector::close(){ - if (markClosed()) { +// Call with closedLock held +bool Connector::closeInternal() { + Mutex::ScopedLock l(closedLock); + if (!closed) { socket.close(); - receiver.join(); + closed = true; + return true; } + return false; +} + +void Connector::close() { + closeInternal(); } void Connector::setInputHandler(InputHandler* handler){ @@ -108,20 +118,9 @@ void Connector::writeToSocket(char* data, size_t available){ } } -void Connector::handleClosed(){ - if (markClosed()) { - socket.close(); - if(shutdownHandler) shutdownHandler->shutdown(); - } -} - -bool Connector::markClosed(){ - if (closed) { - return false; - } else { - closed = true; - return true; - } +void Connector::handleClosed() { + if (closeInternal() && shutdownHandler) + shutdownHandler->shutdown(); } void Connector::checkIdle(ssize_t status){ diff --git a/cpp/src/qpid/client/Connector.h b/cpp/src/qpid/client/Connector.h index 56eea95dd1..9447a05a07 100644 --- a/cpp/src/qpid/client/Connector.h +++ b/cpp/src/qpid/client/Connector.h @@ -77,7 +77,7 @@ class Connector : public framing::OutputHandler, void run(); void handleClosed(); - bool markClosed(); + bool closeInternal(); friend class Channel; public: diff --git a/cpp/src/tests/python_tests b/cpp/src/tests/python_tests index 2c0b6b2071..57cbba6848 100755 --- a/cpp/src/tests/python_tests +++ b/cpp/src/tests/python_tests @@ -1,7 +1,7 @@ #!/bin/sh # Run the python tests. if test -d ../../../python ; then - cd ../../../python && ./run-tests -v -s "0-9" -e ../specs/amqp-dtx-preview.0-9.xml -I cpp_failing_0-9.txt $PYTHON_TESTS + cd ../../../python && ./run-tests -v -s "0-9" -e ../specs/amqp-dtx-preview.0-9.xml -I cpp_failing_0-9.txt -b localhost:$QPID_PORT $PYTHON_TESTS else echo Warning: python tests not found. fi |