mirror of
https://github.com/nmap/nmap.git
synced 2025-12-10 09:49:05 +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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user