From: Francis Dupont Date: Mon, 10 Dec 2018 16:58:13 +0000 (+0100) Subject: [283-perfdhcp-fix-send-due] Fixed late sent flag X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9340447b52f26b565243cd4b1e00349a53df1825;p=thirdparty%2Fkea.git [283-perfdhcp-fix-send-due] Fixed late sent flag --- 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; + } } }