From a2ab8f27435fe79712ed67a2d81fad6f96d08073 Mon Sep 17 00:00:00 2001 From: Marcin Siodelski Date: Mon, 25 Mar 2019 18:50:41 +0100 Subject: [PATCH] [#103,!277] Added Dhcpv4Srv::inTestMode as a result of review. --- src/bin/dhcp4/ctrl_dhcp4_srv.cc | 2 +- src/bin/dhcp4/dhcp4_srv.h | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/bin/dhcp4/ctrl_dhcp4_srv.cc b/src/bin/dhcp4/ctrl_dhcp4_srv.cc index 6f3d40d44c..d922dd8cfc 100644 --- a/src/bin/dhcp4/ctrl_dhcp4_srv.cc +++ b/src/bin/dhcp4/ctrl_dhcp4_srv.cc @@ -686,7 +686,7 @@ ControlledDhcpv4Srv::processConfig(isc::data::ConstElementPtr config) { // prevents us from waiting 1 second on more before the timer goes off. // Instead, we wait one millisecond which significantly reduces the // test time. - if (server_->getServerPort() != 0) { + if (!server_->inTestMode()) { fetch_time = 1000 * fetch_time; } diff --git a/src/bin/dhcp4/dhcp4_srv.h b/src/bin/dhcp4/dhcp4_srv.h index a92f9f1f7c..72680fff36 100644 --- a/src/bin/dhcp4/dhcp4_srv.h +++ b/src/bin/dhcp4/dhcp4_srv.h @@ -234,6 +234,14 @@ public: /// @brief Destructor. Used during DHCPv4 service shutdown. virtual ~Dhcpv4Srv(); + /// @brief Checks if the server is running in a test mode. + /// + /// @return true if the server is running in the test mode, + /// false otherwise. + bool inTestMode() const { + return (server_port_ == 0); + } + /// @brief Returns pointer to the IO service used by the server. asiolink::IOServicePtr& getIOService() { return (io_service_); -- 2.47.2