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/tests/InProcessBroker.h | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'cpp/src/tests/InProcessBroker.h') diff --git a/cpp/src/tests/InProcessBroker.h b/cpp/src/tests/InProcessBroker.h index 9fa0135502..f014941743 100644 --- a/cpp/src/tests/InProcessBroker.h +++ b/cpp/src/tests/InProcessBroker.h @@ -99,7 +99,8 @@ class InProcessConnector : } } } - catch (const ClosedException&) { + catch (const std::exception& e) { + QPID_LOG(debug, QPID_MSG(receiver << " Terminated: " << e.what())); return; } } @@ -155,7 +156,8 @@ class InProcessConnector : } }; - InProcessConnector(shared_ptr b, + + InProcessConnector(shared_ptr b=broker::Broker::create(), framing::ProtocolVersion v=framing::ProtocolVersion()) : Connector(v), protocolInit(v), @@ -204,6 +206,8 @@ class InProcessConnector : clientOut.queue.setConnectionInputHandler(0); } + shared_ptr getBroker() { return broker; } + private: sys::Mutex lock; framing::ProtocolInitiation protocolInit; @@ -215,29 +219,25 @@ class InProcessConnector : }; struct InProcessConnection : public client::Connection { - InProcessConnection(shared_ptr b) + /** Connect to an existing broker */ + InProcessConnection(shared_ptr b=broker::Broker::create()) : client::Connection( - shared_ptr( - new InProcessConnector(b))) - { - open(""); - } + shared_ptr(new InProcessConnector(b))) + { open(""); } - ~InProcessConnection() { } + InProcessConnector& getConnector() { + return static_cast(*impl->getConnector()); + } /** Simulate disconnected network connection. */ - void disconnect() { impl->getConnector()->close(); } + void disconnect() { getConnector().close(); } - /** Sliently discard frames sent by either party, lost network traffic. */ - void discard() { - dynamic_pointer_cast( - impl->getConnector())->discard(); - } -}; + /** Discard frames, simulates lost network traffic. */ + void discard() { getConnector().discard(); } -/** A connector with its own broker */ -struct InProcessBroker : public InProcessConnector { - InProcessBroker() : InProcessConnector(broker::Broker::create()) {} + shared_ptr getBroker() { + return getConnector().getBroker(); + } }; } // namespace qpid -- cgit v1.2.1