From e8d55de7e2b5e5841b6a2a74afb043bf53161222 Mon Sep 17 00:00:00 2001 From: Francis Dupont Date: Mon, 10 Dec 2018 18:40:23 +0100 Subject: [PATCH] [283-perfdhcp-fix-send-due] Revamped short waits --- src/bin/perfdhcp/test_control.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/bin/perfdhcp/test_control.cc b/src/bin/perfdhcp/test_control.cc index b92aee93b5..f27fc27090 100644 --- a/src/bin/perfdhcp/test_control.cc +++ b/src/bin/perfdhcp/test_control.cc @@ -1535,7 +1535,9 @@ TestControl::run() { // Calculate number of packets to be sent to stay // catch up with rate. uint64_t packets_due = basic_rate_control_.getOutboundMessageCount(); - checkLateMessages(basic_rate_control_); + if (packets_due > 0) { + checkLateMessages(basic_rate_control_); + } if ((packets_due == 0) && testDiags('i')) { if (options.getIpVersion() == 4) { stats_mgr4_->incrementCounter("shortwait"); @@ -1555,7 +1557,7 @@ TestControl::run() { break; } - if (!hasLateExitCommenced()) { + if ((packets_due > 0) && !hasLateExitCommenced()) { // Initiate new DHCP packet exchanges. sendPackets(socket, packets_due); } @@ -1565,7 +1567,9 @@ TestControl::run() { if (options.getRenewRate() != 0) { uint64_t renew_packets_due = renew_rate_control_.getOutboundMessageCount(); - checkLateMessages(renew_rate_control_); + if (renew_packets_due > 0) { + checkLateMessages(renew_rate_control_); + } // Send multiple renews to satisfy the desired rate. if (options.getIpVersion() == 4) { @@ -1580,7 +1584,9 @@ TestControl::run() { if ((options.getIpVersion() == 6) && (options.getReleaseRate() != 0)) { uint64_t release_packets_due = release_rate_control_.getOutboundMessageCount(); - checkLateMessages(release_rate_control_); + if (release_packets_due > 0) { + checkLateMessages(release_rate_control_); + } // Send Release messages. sendMultipleMessages6(socket, DHCPV6_RELEASE, release_packets_due); } -- 2.47.3