diff options
| author | Alan Conway <aconway@apache.org> | 2008-05-26 21:46:00 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2008-05-26 21:46:00 +0000 |
| commit | 42bac9eab5cc800807a3fa2d8e6c30d5888b209e (patch) | |
| tree | 891845ca754e823c683ff8a888bf1fef66c2ff93 /cpp/src/qpid/client/Connection.cpp | |
| parent | aaa31ef665147973b3367110db9c0810fb144d9e (diff) | |
| download | qpid-python-42bac9eab5cc800807a3fa2d8e6c30d5888b209e.tar.gz | |
Fixed intermittent leak of client::Connector thread.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@660320 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/Connection.cpp')
| -rw-r--r-- | cpp/src/qpid/client/Connection.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/cpp/src/qpid/client/Connection.cpp b/cpp/src/qpid/client/Connection.cpp index bec2b0345d..c108c3c86a 100644 --- a/cpp/src/qpid/client/Connection.cpp +++ b/cpp/src/qpid/client/Connection.cpp @@ -63,9 +63,13 @@ void Connection::open( open(settings); } +bool Connection::isOpen() const { + return impl && impl->isOpen(); +} + void Connection::open(const ConnectionSettings& settings) { - if (impl) + if (isOpen()) throw Exception(QPID_MSG("Connection::open() was already called")); impl = shared_ptr<ConnectionImpl>(new ConnectionImpl(version, settings)); @@ -74,7 +78,7 @@ void Connection::open(const ConnectionSettings& settings) } Session Connection::newSession(const std::string& name) { - if (!impl) + if (!isOpen()) throw Exception(QPID_MSG("Connection has not yet been opened")); shared_ptr<SessionImpl> simpl( new SessionImpl(name, impl, ++channelIdCounter, max_frame_size)); @@ -86,8 +90,8 @@ Session Connection::newSession(const std::string& name) { } void Connection::resume(Session& session) { - if (!impl) - throw Exception(QPID_MSG("Connection has not yet been opened")); + if (!isOpen()) + throw Exception(QPID_MSG("Connection is not open.")); session.impl->setChannel(++channelIdCounter); impl->addSession(session.impl); @@ -95,10 +99,7 @@ void Connection::resume(Session& session) { } void Connection::close() { - if (impl) { - impl->close(); - impl.reset(); - } + impl->close(); } }} // namespace qpid::client |
