From: Thomas Markwalder Date: Wed, 8 Jul 2015 13:01:53 +0000 (-0400) Subject: [3769] Addressed review comments X-Git-Tag: trac3785_base~2^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6d898ec4bb9418c7a675f358c05d4801b6b1cdf;p=thirdparty%2Fkea.git [3769] Addressed review comments Removed Daemon::init() method, improved server log message descpriptions, and minor typos. --- diff --git a/src/bin/d2/d2_messages.mes b/src/bin/d2/d2_messages.mes index 383c64f13c..ee7e995f97 100644 --- a/src/bin/d2/d2_messages.mes +++ b/src/bin/d2/d2_messages.mes @@ -107,7 +107,8 @@ indicates an attempt to start a second instance of DHCP_DDNS using the same configuration file. It is possible, though unlikely, that the PID file is a remnant left behind by a server crash or power failure and the PID it contains refers to a process other than DHCP_DDNS. In such an event, -it would be necessary to manually remove the PID file. +it would be necessary to manually remove the PID file. The first argument is +the DHCP_DDNS process name, the second contains the PID and and PID file. % DHCP_DDNS_AT_MAX_TRANSACTIONS application has %1 queued requests but has reached maximum number of %2 concurrent transactions This is a debug message that indicates that the application has DHCP_DDNS @@ -292,7 +293,8 @@ its PID file. The log message should contain details sufficient to determine the underlying cause. The most likely culprits are that some portion of the pathname does not exist or a permissions issue. The default path is determined by --localstatedir configure paramter but -may be overridden by setting environment variable, KEA_PIDFILE_DIR. +may be overridden by setting environment variable, KEA_PIDFILE_DIR. The +first argument is the DHCP_DDNS process name. % DHCP_DDNS_PROCESS_INIT application init invoked This is a debug message issued when the DHCP-DDNS application enters diff --git a/src/bin/dhcp4/dhcp4_messages.mes b/src/bin/dhcp4/dhcp4_messages.mes index 9c358abbf4..fb96e90882 100644 --- a/src/bin/dhcp4/dhcp4_messages.mes +++ b/src/bin/dhcp4/dhcp4_messages.mes @@ -27,7 +27,8 @@ the server using the same configuration file. It is possible, though unlikely that the PID file is a remnant left behind by a server crash or power failure and the PID it contains refers to a process other than the server. In such an event, it would be necessary to manually remove -the PID file. +the PID file. The first argument is the DHCPv4 process name, the +second contains the PID and and PID file. % DHCP4_BUFFER_RECEIVED received buffer from %1:%2 to %3:%4 over interface %5 This debug message is logged when the server has received a packet diff --git a/src/bin/dhcp6/dhcp6_messages.mes b/src/bin/dhcp6/dhcp6_messages.mes index b82e6475e9..9d0b4fb3d4 100644 --- a/src/bin/dhcp6/dhcp6_messages.mes +++ b/src/bin/dhcp6/dhcp6_messages.mes @@ -27,7 +27,8 @@ the server using the same configuration file. It is possible, though unlikely that the PID file is a remnant left behind by a server crash or power failure and the PID it contains refers to a process other than the server. In such an event, it would be necessary to manually remove -the PID file. +the PID file. The first argument is the DHCPv6 process name, the second +contains the PID and and PID file. % DHCP6_ADD_GLOBAL_STATUS_CODE %1: adding Status Code to DHCPv6 packet: %2 This message is logged when the server is adding the top-level diff --git a/src/lib/dhcpsrv/daemon.cc b/src/lib/dhcpsrv/daemon.cc index a020b0abb2..4ff010a93d 100644 --- a/src/lib/dhcpsrv/daemon.cc +++ b/src/lib/dhcpsrv/daemon.cc @@ -52,10 +52,6 @@ Daemon::~Daemon() { } } -void Daemon::init(const std::string& config_file) { - config_file_ = config_file; -} - void Daemon::cleanup() { } diff --git a/src/lib/dhcpsrv/daemon.h b/src/lib/dhcpsrv/daemon.h index 94a6e38ab9..0147401aa6 100644 --- a/src/lib/dhcpsrv/daemon.h +++ b/src/lib/dhcpsrv/daemon.h @@ -69,29 +69,6 @@ public: /// virtual destructor as well. virtual ~Daemon(); - /// @brief Initializes the server. - /// - /// @todo #3753 - This method should be revisited as its original purpose - /// has been lost. As of #3769, it has been superseded with setConfigFile(). - /// None of the following is currently accurate. - /// - /// Depending on the configuration backend, it establishes msgq session, - /// or reads the configuration file. - /// - /// Note: This function may throw to report enountered problems. It may - /// also return false if the initialization was skipped. That may seem - /// redundant, but the idea here is that in some cases the configuration - /// was read, understood and the decision was made to not start. One - /// case where such capability could be needed is when we have a single - /// config file for Kea4 and D2, but the DNS Update is disabled. It is - /// likely that the D2 will be started, it will analyze its config file, - /// decide that it is not needed and will shut down. - /// - /// @note this method may throw - /// - /// @param config_file Config file name (may be empty if unused). - virtual void init(const std::string& config_file); - /// @brief Performs final deconfiguration. /// /// Performs configuration backend specific final clean-up. This is called diff --git a/src/lib/dhcpsrv/tests/daemon_unittest.cc b/src/lib/dhcpsrv/tests/daemon_unittest.cc index afc791fe70..e47b332cbc 100644 --- a/src/lib/dhcpsrv/tests/daemon_unittest.cc +++ b/src/lib/dhcpsrv/tests/daemon_unittest.cc @@ -78,10 +78,10 @@ TEST_F(DaemonTest, constructor) { Daemon instance2; EXPECT_FALSE(instance2.getVerbose()); - EXPECT_EQ("",instance2.getConfigFile()); - EXPECT_EQ("",instance2.getProcName()); + EXPECT_TRUE(instance2.getConfigFile().empty()); + EXPECT_TRUE(instance2.getProcName().empty()); EXPECT_EQ(CfgMgr::instance().getDataDir(),instance2.getPIDFileDir()); - EXPECT_EQ("",instance2.getPIDFileName()); + EXPECT_TRUE(instance2.getPIDFileName().empty()); } // Verify config file accessors diff --git a/src/lib/testutils/dhcp_test_lib.sh.in b/src/lib/testutils/dhcp_test_lib.sh.in index a07cc47339..dd542324ee 100644 --- a/src/lib/testutils/dhcp_test_lib.sh.in +++ b/src/lib/testutils/dhcp_test_lib.sh.in @@ -447,7 +447,7 @@ verify_server_pid() { clean_exit 1 fi - # Only the file name portio of the config file is used, try and + # Only the file name portion of the config file is used, try and # extract it. NOTE if this "algorithm" changes this code will need # to be updated. fname=`basename ${cfg_file}` diff --git a/src/lib/util/pid_file.cc b/src/lib/util/pid_file.cc index 9ebd1be73d..42bde7e3cc 100644 --- a/src/lib/util/pid_file.cc +++ b/src/lib/util/pid_file.cc @@ -51,7 +51,7 @@ PIDFile::check() const { << filename_ << "'"); } - // If the process is still running return true + // If the process is still running return its pid. if (kill(pid, 0) == 0) { return (pid); }