diff options
author | Aidan Skinner <aidan@apache.org> | 2009-09-17 16:21:13 +0000 |
---|---|---|
committer | Aidan Skinner <aidan@apache.org> | 2009-09-17 16:21:13 +0000 |
commit | 7d6a028be9f6c47418e98a6fa74a359864428150 (patch) | |
tree | 78083427e88c48edb3b23605309e57f1301cba19 /qpid/cpp/src/tests/SocketProxy.h | |
parent | 31bbc100ac6b3a31eb25d29f407d60ff23334d1f (diff) | |
download | qpid-python-7d6a028be9f6c47418e98a6fa74a359864428150.tar.gz |
Merge from trunk
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/java-network-refactor@816261 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/SocketProxy.h')
-rw-r--r-- | qpid/cpp/src/tests/SocketProxy.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/qpid/cpp/src/tests/SocketProxy.h b/qpid/cpp/src/tests/SocketProxy.h index ccce3c8842..9df32a1336 100644 --- a/qpid/cpp/src/tests/SocketProxy.h +++ b/qpid/cpp/src/tests/SocketProxy.h @@ -35,8 +35,11 @@ #include "qpid/sys/Mutex.h" #include "qpid/log/Statement.h" +namespace qpid { +namespace tests { + /** - * A simple socket proxy that forwards to another socket. + * A simple socket proxy that forwards to another socket. * Used between client & local broker to simulate network failures. */ class SocketProxy : private qpid::sys::Runnable @@ -59,7 +62,7 @@ class SocketProxy : private qpid::sys::Runnable joined = false; thread = qpid::sys::Thread(static_cast<qpid::sys::Runnable*>(this)); } - + ~SocketProxy() { close(); if (!joined) thread.join(); } /** Simulate a network disconnect. */ @@ -88,7 +91,7 @@ class SocketProxy : private qpid::sys::Runnable } uint16_t getPort() const { return port; } - + private: static void throwErrno(const std::string& msg) { throw qpid::Exception(msg+":"+qpid::sys::strError(errno)); @@ -153,7 +156,7 @@ class SocketProxy : private qpid::sys::Runnable } try { if (server.get()) server->close(); - close(); + close(); } catch (const std::exception& e) { QPID_LOG(debug, "SocketProxy::run exception in client/server close()" << e.what()); @@ -169,4 +172,6 @@ class SocketProxy : private qpid::sys::Runnable bool dropClient, dropServer; }; +}} // namespace qpid::tests + #endif |