From 11486e255aef704114645f8e7c5fee9c3abf9e76 Mon Sep 17 00:00:00 2001 From: Francis Dupont Date: Tue, 16 Oct 2018 18:27:24 +0200 Subject: [PATCH] [153-netconf-control-socket] Addressed review comments --- src/bin/netconf/http_control_socket.h | 5 ++++- src/bin/netconf/stdout_control_socket.cc | 3 --- src/bin/netconf/tests/control_socket_unittests.cc | 3 +-- src/bin/netconf/unix_control_socket.cc | 1 + src/bin/netconf/unix_control_socket.h | 5 ++++- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/bin/netconf/http_control_socket.h b/src/bin/netconf/http_control_socket.h index 752f13b0ec..48023733ce 100644 --- a/src/bin/netconf/http_control_socket.h +++ b/src/bin/netconf/http_control_socket.h @@ -63,7 +63,10 @@ public: const std::string& service); private: - /// @brief Preform the actual communication. + /// @brief Perform the actual communication. + /// + /// @todo Use persistent connections (vs. a new connection per call) + /// as the HTTP library supports them. /// /// @param command The command to send. /// @return The answer. diff --git a/src/bin/netconf/stdout_control_socket.cc b/src/bin/netconf/stdout_control_socket.cc index d0219016e0..0477ea2f48 100644 --- a/src/bin/netconf/stdout_control_socket.cc +++ b/src/bin/netconf/stdout_control_socket.cc @@ -50,9 +50,6 @@ StdoutControlSocket::configTest(ConstElementPtr /*config*/, ConstElementPtr StdoutControlSocket::configSet(ConstElementPtr config, const string& service) { - output_ << "//////////////// " - << service << " configuration " - << "////////////////" << endl; prettyPrint(config, output_); output_ << endl; return (createAnswer()); diff --git a/src/bin/netconf/tests/control_socket_unittests.cc b/src/bin/netconf/tests/control_socket_unittests.cc index ba8491496a..0bd2f81c7c 100644 --- a/src/bin/netconf/tests/control_socket_unittests.cc +++ b/src/bin/netconf/tests/control_socket_unittests.cc @@ -119,8 +119,7 @@ TEST(StdoutControlSocketTest, configSet) { EXPECT_EQ("{ \"result\": 0 }", answer->str()); // Check output. - string expected = "//////////////// foo configuration ////////////////\n" - "{\n \"bar\": 1\n}\n"; + string expected = "{\n \"bar\": 1\n}\n"; EXPECT_EQ(expected, os.str()); } diff --git a/src/bin/netconf/unix_control_socket.cc b/src/bin/netconf/unix_control_socket.cc index 2553371e8a..93a807eb1d 100644 --- a/src/bin/netconf/unix_control_socket.cc +++ b/src/bin/netconf/unix_control_socket.cc @@ -56,6 +56,7 @@ UnixControlSocket::configSet(ConstElementPtr config, ConstElementPtr UnixControlSocket::sendCommand(ConstElementPtr command) { + // We are using our own IO service because this method is synchronous. IOServicePtr io_service(new IOService()); ClientConnection conn(*io_service); boost::system::error_code received_ec; diff --git a/src/bin/netconf/unix_control_socket.h b/src/bin/netconf/unix_control_socket.h index 08c9589765..09fe7c1e99 100644 --- a/src/bin/netconf/unix_control_socket.h +++ b/src/bin/netconf/unix_control_socket.h @@ -63,7 +63,10 @@ public: const std::string& service); private: - /// @brief Preform the actual communication. + /// @brief Perform the actual communication. + /// + /// @note This method is synchronous, i.e. it blocks until it finishes + /// and returns. /// /// @param command The command to send. /// @return The answer. -- 2.47.2