summaryrefslogtreecommitdiff
path: root/cpp/src/tests/SocketProxy.h
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2009-09-09 19:46:56 +0000
committerAndrew Stitcher <astitcher@apache.org>2009-09-09 19:46:56 +0000
commitfbddf29b719cd610b01b2459c4827d636cda6c73 (patch)
tree4f1a87c509b151d428eca8c3c01c1bea0cd205a4 /cpp/src/tests/SocketProxy.h
parentfd40457f6f471d10c3c804202d2329c93b2cb29e (diff)
downloadqpid-python-fbddf29b719cd610b01b2459c4827d636cda6c73.tar.gz
Tidied up namespace usage
Miscelleneous whitespace fixes git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@813094 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/SocketProxy.h')
-rw-r--r--cpp/src/tests/SocketProxy.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/cpp/src/tests/SocketProxy.h b/cpp/src/tests/SocketProxy.h
index ccce3c8842..9df32a1336 100644
--- a/cpp/src/tests/SocketProxy.h
+++ b/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