From 9a5521b5aaaf1f620c4210ecf09e180ed2934988 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Sat, 1 Dec 2007 05:11:38 +0000 Subject: Fix problem where client does notice disconnection from Broker. src/qpid/client/SessionCore.cpp: close/open Demux on suspend/resume. src/tests/exception_test.cpp: convert to Session API, boost test. - Temporarily disabled due issues noted in TODO comments git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@600046 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/client/Demux.cpp | 9 +++++++++ cpp/src/qpid/client/Demux.h | 1 + cpp/src/qpid/client/SessionCore.cpp | 9 +++++---- 3 files changed, 15 insertions(+), 4 deletions(-) (limited to 'cpp/src/qpid/client') diff --git a/cpp/src/qpid/client/Demux.cpp b/cpp/src/qpid/client/Demux.cpp index bd1dda0ae9..e61103981b 100644 --- a/cpp/src/qpid/client/Demux.cpp +++ b/cpp/src/qpid/client/Demux.cpp @@ -74,6 +74,15 @@ void Demux::close() defaultQueue->close(); } +void Demux::open() +{ + sys::Mutex::ScopedLock l(lock); + for (iterator i = records.begin(); i != records.end(); i++) { + i->queue->open(); + } + defaultQueue->open(); +} + Demux::QueuePtr Demux::add(const std::string& name, Condition condition) { sys::Mutex::ScopedLock l(lock); diff --git a/cpp/src/qpid/client/Demux.h b/cpp/src/qpid/client/Demux.h index 5aaf75db44..234282a8d2 100644 --- a/cpp/src/qpid/client/Demux.h +++ b/cpp/src/qpid/client/Demux.h @@ -51,6 +51,7 @@ public: void handle(framing::FrameSet::shared_ptr); void close(); + void open(); QueuePtr add(const std::string& name, Condition); void remove(const std::string& name); diff --git a/cpp/src/qpid/client/SessionCore.cpp b/cpp/src/qpid/client/SessionCore.cpp index 3f042bc13a..ee9e9570ed 100644 --- a/cpp/src/qpid/client/SessionCore.cpp +++ b/cpp/src/qpid/client/SessionCore.cpp @@ -125,26 +125,26 @@ void SessionCore::detach(int c, const std::string& t) { channel.next = 0; code=c; text=t; + l3.getDemux().close(); } void SessionCore::doClose(int code, const std::string& text) { if (state != CLOSED) { session.reset(); - l3.getDemux().close(); - l3.getCompletionTracker().close(); detach(code, text); setState(CLOSED); + l3.getCompletionTracker().close(); } invariant(); } void SessionCore::doSuspend(int code, const std::string& text) { - if (state != CLOSED) { - invariant(); + if (state != CLOSED && state != SUSPENDED) { detach(code, text); session->suspend(); setState(SUSPENDED); } + invariant(); } ExecutionHandler& SessionCore::getExecution() { // user thread @@ -221,6 +221,7 @@ void SessionCore::resume(shared_ptr c) { channel.handle(*i); // Direct to channel. check(); } + l3.getDemux().open(); } } -- cgit v1.2.1