diff options
| author | Alan Conway <aconway@apache.org> | 2007-12-01 05:11:38 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2007-12-01 05:11:38 +0000 |
| commit | a60f37242a56cd00e223b81e963b61fe66f55b72 (patch) | |
| tree | ee6f9c61f21fea19a528a51f71a6f355ca77afce /qpid/cpp/src/tests/InProcessBroker.h | |
| parent | d8e81db203b43b4f57db90b66be0eeb5e6ffb23f (diff) | |
| download | qpid-python-a60f37242a56cd00e223b81e963b61fe66f55b72.tar.gz | |
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@600046 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/InProcessBroker.h')
| -rw-r--r-- | qpid/cpp/src/tests/InProcessBroker.h | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/qpid/cpp/src/tests/InProcessBroker.h b/qpid/cpp/src/tests/InProcessBroker.h index 9fa0135502..f014941743 100644 --- a/qpid/cpp/src/tests/InProcessBroker.h +++ b/qpid/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<broker::Broker> b, + + InProcessConnector(shared_ptr<broker::Broker> 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<broker::Broker> getBroker() { return broker; } + private: sys::Mutex lock; framing::ProtocolInitiation protocolInit; @@ -215,29 +219,25 @@ class InProcessConnector : }; struct InProcessConnection : public client::Connection { - InProcessConnection(shared_ptr<broker::Broker> b) + /** Connect to an existing broker */ + InProcessConnection(shared_ptr<broker::Broker> b=broker::Broker::create()) : client::Connection( - shared_ptr<client::Connector>( - new InProcessConnector(b))) - { - open(""); - } + shared_ptr<client::Connector>(new InProcessConnector(b))) + { open(""); } - ~InProcessConnection() { } + InProcessConnector& getConnector() { + return static_cast<InProcessConnector&>(*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<InProcessConnector>( - 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<broker::Broker> getBroker() { + return getConnector().getBroker(); + } }; } // namespace qpid |
