1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 06:01:28 +00:00

o Fixed a division by zero error in the packet rate measuring code

that could cause a display of infinity packets per seconds near the
  start of a scan. [Jah]
This commit is contained in:
david
2008-12-17 02:48:14 +00:00
parent 7922c3edb5
commit 9fe196bb0b
2 changed files with 11 additions and 1 deletions

View File

@@ -1,5 +1,9 @@
# Nmap Changelog ($Id$); -*-text-*-
o Fixed a division by zero error in the packet rate measuring code
that could cause a display of infinity packets per seconds near the
start of a scan. [Jah]
o Complete re-write of the marshalling logic for Microsoft RPC calls.
[Ron Bowes]

View File

@@ -349,7 +349,13 @@ void RateMeter::update(double amount, const struct timeval *now) {
}
double RateMeter::getOverallRate(const struct timeval *now) const {
return total / elapsedTime(now);
double elapsed;
elapsed = elapsedTime(now);
if (elapsed <= 0.0)
return 0.0;
else
return total / elapsed;
}
/* Get the "current" rate (actually a moving average of the last