Browse Source

[5107] Changes after review:
- typos corrected
- copyright years updated
- added comments

Tomek Mrugalski 8 years ago
parent
commit
b21fcdaf3c

+ 1 - 1
src/bin/agent/ctrl_agent_controller.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC")
 //
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // License, v. 2.0. If a copy of the MPL was not distributed with this

+ 13 - 0
src/bin/agent/ctrl_agent_process.cc

@@ -18,6 +18,7 @@ using namespace isc::http;
 using namespace isc::process;
 using namespace isc::process;
 
 
 // Temporarily hardcoded configuration.
 // Temporarily hardcoded configuration.
+/// @todo: remove once 5134 is merged.
 namespace {
 namespace {
 
 
 const IOAddress SERVER_ADDRESS("127.0.0.1");
 const IOAddress SERVER_ADDRESS("127.0.0.1");
@@ -47,14 +48,26 @@ CtrlAgentProcess::run() {
 
 
     try {
     try {
 
 
+        // Create response creator factory first. It will be used to generate
+        // response creators. Each response creator will be used to generate
+        // answer to specific request.
         HttpResponseCreatorFactoryPtr rcf(new CtrlAgentResponseCreatorFactory());
         HttpResponseCreatorFactoryPtr rcf(new CtrlAgentResponseCreatorFactory());
+
+        // Create http listener. It will open up a TCP socket and be prepared
+        // to accept incoming connection.
         HttpListener http_listener(*getIoService(), SERVER_ADDRESS,
         HttpListener http_listener(*getIoService(), SERVER_ADDRESS,
                                    SERVER_PORT, rcf, REQUEST_TIMEOUT);
                                    SERVER_PORT, rcf, REQUEST_TIMEOUT);
+
+        // Instruct the http listener to actually open socket, install callback
+        // and start listening.
         http_listener.start();
         http_listener.start();
 
 
+        // Ok, seems we're good to go.
         LOG_INFO(agent_logger, CTRL_AGENT_HTTP_SERVICE_STARTED)
         LOG_INFO(agent_logger, CTRL_AGENT_HTTP_SERVICE_STARTED)
             .arg(SERVER_ADDRESS.toText()).arg(SERVER_PORT);
             .arg(SERVER_ADDRESS.toText()).arg(SERVER_PORT);
 
 
+        // Let's process incoming data or expiring timers in a loop until
+        // shutdown condition is detected.
         while (!shouldShutdown()) {
         while (!shouldShutdown()) {
             getIoService()->run_one();
             getIoService()->run_one();
         }
         }

+ 4 - 4
src/bin/agent/tests/ctrl_agent_response_creator_unittest.cc

@@ -104,8 +104,8 @@ public:
     /// @param command_arguments Command arguments (empty).
     /// @param command_arguments Command arguments (empty).
     ///
     ///
     /// @return Returns response with a single string "bar".
     /// @return Returns response with a single string "bar".
-    ConstElementPtr fooCommandHandler(const std::string& command_name,
-                                      const ConstElementPtr& command_arguments) {
+    ConstElementPtr fooCommandHandler(const std::string& /*command_name*/,
+                                      const ConstElementPtr& /*command_arguments*/) {
         ElementPtr arguments = Element::createList();
         ElementPtr arguments = Element::createList();
         arguments->add(Element::create("bar"));
         arguments->add(Element::create("bar"));
         return (createAnswer(CONTROL_RESULT_SUCCESS, arguments));
         return (createAnswer(CONTROL_RESULT_SUCCESS, arguments));
@@ -122,7 +122,7 @@ public:
 
 
 };
 };
 
 
-// This test verifies that the created "empty" reuqest has valid type.
+// This test verifies that the created "empty" request has valid type.
 TEST_F(CtrlAgentResponseCreatorTest, createNewHttpRequest) {
 TEST_F(CtrlAgentResponseCreatorTest, createNewHttpRequest) {
     // The request must be of PostHttpRequestJson type.
     // The request must be of PostHttpRequestJson type.
     PostHttpRequestJsonPtr request_json = boost::dynamic_pointer_cast<
     PostHttpRequestJsonPtr request_json = boost::dynamic_pointer_cast<
@@ -144,7 +144,7 @@ TEST_F(CtrlAgentResponseCreatorTest, createStockHttpResponseHighVersion) {
                       "HTTP/1.0 408 Request Timeout");
                       "HTTP/1.0 408 Request Timeout");
 }
 }
 
 
-// Test that the server responsds with version 1.1 if request version is 1.1.
+// Test that the server responds with version 1.1 if request version is 1.1.
 TEST_F(CtrlAgentResponseCreatorTest, createStockHttpResponseCorrectVersion) {
 TEST_F(CtrlAgentResponseCreatorTest, createStockHttpResponseCorrectVersion) {
     request_->context()->http_version_major_ = 1;
     request_->context()->http_version_major_ = 1;
     request_->context()->http_version_minor_ = 1;
     request_->context()->http_version_minor_ = 1;

+ 1 - 0
src/lib/http/connection.h

@@ -175,6 +175,7 @@ private:
     /// @brief Stops current connection.
     /// @brief Stops current connection.
     void stopThisConnection();
     void stopThisConnection();
 
 
+    /// @brief returns remote address in textual form
     std::string getRemoteEndpointAddressAsText() const;
     std::string getRemoteEndpointAddressAsText() const;
 
 
     /// @brief Timer used to detect Request Timeout.
     /// @brief Timer used to detect Request Timeout.

+ 1 - 1
src/lib/http/tests/response_unittests.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC")
 //
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // License, v. 2.0. If a copy of the MPL was not distributed with this