From a005b820be55b3d25b9493e8b7f14f05231913c1 Mon Sep 17 00:00:00 2001 From: david Date: Sat, 31 Dec 2011 21:59:54 +0000 Subject: [PATCH] Make cwnd updates in osscan2.cc match those in scan_engine.cc. --- osscan2.cc | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/osscan2.cc b/osscan2.cc index c354f0eaf..50e132440 100644 --- a/osscan2.cc +++ b/osscan2.cc @@ -1236,25 +1236,32 @@ void HostOsScan::adjust_times(HostOsScanStats *hss, OFProbe *probe, struct timev } else { /* Good news -- got a response to first try. Increase window as appropriate. */ - if (hss->timing.cwnd <= hss->timing.ssthresh) { - /* In quick start mode */ - hss->timing.cwnd += perf.slow_incr; - } else { - /* Congestion control mode */ - hss->timing.cwnd += perf.ca_incr / hss->timing.cwnd; - } - if (hss->timing.cwnd > perf.max_cwnd) - hss->timing.cwnd = perf.max_cwnd; + stats->timing.num_replies_received++; + hss->timing.num_replies_received++; - if (stats->timing.cwnd <= stats->timing.ssthresh) { - /* In quick start mode */ + if (stats->timing.cwnd < stats->timing.ssthresh) { + /* In slow start mode */ stats->timing.cwnd += perf.slow_incr; + if (stats->timing.cwnd > stats->timing.ssthresh) + stats->timing.cwnd = stats->timing.ssthresh; } else { - /* Congestion control mode */ + /* Congestion avoidance mode */ stats->timing.cwnd += perf.ca_incr / stats->timing.cwnd; } if (stats->timing.cwnd > perf.max_cwnd) stats->timing.cwnd = perf.max_cwnd; + + if (hss->timing.cwnd < hss->timing.ssthresh) { + /* In slow start mode */ + hss->timing.cwnd += perf.slow_incr; + if (hss->timing.cwnd > hss->timing.ssthresh) + hss->timing.cwnd = hss->timing.ssthresh; + } else { + /* Congestion avoidance mode */ + hss->timing.cwnd += perf.ca_incr / hss->timing.cwnd; + } + if (hss->timing.cwnd > perf.max_cwnd) + hss->timing.cwnd = perf.max_cwnd; } }