From 9340447b52f26b565243cd4b1e00349a53df1825 Mon Sep 17 00:00:00 2001 From: Francis Dupont Date: Mon, 10 Dec 2018 17:58:13 +0100 Subject: [PATCH] [283-perfdhcp-fix-send-due] Fixed late sent flag --- src/bin/perfdhcp/rate_control.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/bin/perfdhcp/rate_control.cc b/src/bin/perfdhcp/rate_control.cc index 1d897c22ec..a61cd5840d 100644 --- a/src/bin/perfdhcp/rate_control.cc +++ b/src/bin/perfdhcp/rate_control.cc @@ -108,12 +108,16 @@ RateControl::updateSendDue() { send_due_ = start_time_ + time_duration(0, 0, static_cast(seconds), static_cast(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(fracts)); + if (last_due > currentTime()) { + late_sent_ = true; + } else { + late_sent_ = false; + } } } -- 2.47.2