From 4f32e26db4ce3af8ea54a9159302fe91c57595d1 Mon Sep 17 00:00:00 2001 From: Marcin Siodelski Date: Tue, 4 Apr 2017 21:39:58 +0200 Subject: [PATCH] [5200] Addressed review comments: expanded commentary in UnixDomainSocket. --- .../testutils/test_server_unix_socket.cc | 7 +++++++ .../testutils/test_server_unix_socket.h | 18 +++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/lib/asiolink/testutils/test_server_unix_socket.cc b/src/lib/asiolink/testutils/test_server_unix_socket.cc index 8c1f8048b6..6143b0489d 100644 --- a/src/lib/asiolink/testutils/test_server_unix_socket.cc +++ b/src/lib/asiolink/testutils/test_server_unix_socket.cc @@ -52,6 +52,13 @@ public: /// @brief Handler invoked when data have been received over the socket. /// + /// This is the handler invoked when the data have been received over the + /// socket. If custom response has been specified, this response is sent + /// back to the client. Otherwise, the handler echoes back the request + /// and prepends the word "received ". Finally, it calls a custom + /// callback function (specified in the constructor) to notify that the + /// response has been sent over the socket. + /// /// @param bytes_transferred Number of bytes received. void readHandler(const boost::system::error_code&, size_t bytes_transferred) { diff --git a/src/lib/asiolink/testutils/test_server_unix_socket.h b/src/lib/asiolink/testutils/test_server_unix_socket.h index ae51698de6..68a2dc94cf 100644 --- a/src/lib/asiolink/testutils/test_server_unix_socket.h +++ b/src/lib/asiolink/testutils/test_server_unix_socket.h @@ -22,6 +22,22 @@ namespace test { class ConnectionPool; /// @brief Provides unix domain socket functionality for unit tests. +/// +/// This class represents a server side socket. It can be used to +/// test client's transmission over the unix domain socket. By default, +/// the server side socket echoes the client's message so the client's +/// message (prefixed with the word "received"). +/// +/// It is also possible to specify a custom response from the server +/// instead of eachoing back the request. +/// +/// It is possible to make multiple connections to the server side +/// socket simultaneously. +/// +/// The test should perform IOService::run_one until it finds that +/// the number of responses sent by the server is greater than +/// expected. The number of responses sent so far can be retrieved +/// using @ref TestServerUnixSocket::getResponseNum. class TestServerUnixSocket { public: @@ -34,7 +50,7 @@ public: TestServerUnixSocket(IOService& io_service, const std::string& socket_file_path, const long test_timeout, - const std::string& custom_respons_ = ""); + const std::string& custom_response = ""); /// @brief Destructor. /// -- 2.47.3