]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[283-perfdhcp-fix-send-due] Fixed late sent flag
authorFrancis Dupont <fdupont@isc.org>
Mon, 10 Dec 2018 16:58:13 +0000 (17:58 +0100)
committerFrancis Dupont <fdupont@isc.org>
Sun, 30 Dec 2018 00:26:28 +0000 (01:26 +0100)
src/bin/perfdhcp/rate_control.cc

index 1d897c22ecf9422c6b62e97c62deffb2855a07dc..a61cd5840d7cde6e67bba59f99c00c58b751484a 100644 (file)
@@ -108,12 +108,16 @@ RateControl::updateSendDue() {
         send_due_ = start_time_ +
             time_duration(0, 0, static_cast<long>(seconds),
                           static_cast<long>(fracts));
-    }
-
-    if (send_due_ > currentTime()) {
-        late_sent_ = true;
-    } else {
-        late_sent_ = false;
+        // Compute the time of the last due.
+        offset = 1. / getRate();
+        fracts = offset * time_duration::ticks_per_second();
+        boost::posix_time::ptime last_due =
+            send_due_ - time_duration(0, 0, 0, static_cast<long>(fracts));
+        if (last_due > currentTime()) {
+            late_sent_ = true;
+        } else {
+            late_sent_ = false;
+        }
     }
 }