Fix variable misnomers in MD_STD_SEC
This commit is contained in:
parent
52aeedd31e
commit
ced5a65122
@ -87,7 +87,7 @@ final class MD_STD_SEC {
|
||||
$delay_micoseconds = max($max - 1, 1) * 1000000;
|
||||
}
|
||||
|
||||
return rand($delay_micoseconds - 100000, $delay_micoseconds);
|
||||
return max(0, rand($delay_micoseconds - 100000, $delay_micoseconds));
|
||||
|
||||
}
|
||||
|
||||
@ -97,6 +97,7 @@ final class MD_STD_SEC {
|
||||
* @param string $tool_name Identifier of the login.
|
||||
* @param string $username Username to look for.
|
||||
* @param integer $max_execution_time Optional maximum execution time to stay below.
|
||||
* In seconds.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
@ -154,10 +155,12 @@ final class MD_STD_SEC {
|
||||
$delay_multiplier_per_ip,
|
||||
$max_execution_time);
|
||||
|
||||
\error_log("Logged in: " . $username . "; Delay: " . ($delay_micoseconds / 1000000) . " seconds");
|
||||
|
||||
// Sleep
|
||||
\usleep($delay_micoseconds);
|
||||
|
||||
if ($delay_micoseconds > \abs($max_execution_microseconds - 1000000)) {
|
||||
if ($delay_micoseconds > \abs($max_execution_time - 1000000)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user