]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#103,!277] Added Dhcpv4Srv::inTestMode as a result of review.
authorMarcin Siodelski <marcin@isc.org>
Mon, 25 Mar 2019 17:50:41 +0000 (18:50 +0100)
committerMarcin Siodelski <marcin@isc.org>
Tue, 26 Mar 2019 07:08:57 +0000 (03:08 -0400)
src/bin/dhcp4/ctrl_dhcp4_srv.cc
src/bin/dhcp4/dhcp4_srv.h

index 6f3d40d44cb3095aa77591d6194a500f9b4d450f..d922dd8cfced2bc4f0291a832267224c470094ea 100644 (file)
@@ -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;
             }
 
index a92f9f1f7ccb0854491ca1b2f39b09031f78a3fa..72680fff36e85f773dcc610d57a3e41d63653c30 100644 (file)
@@ -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_);