Skip to content
Snippets Groups Projects
Commit d8b03aeb authored by Dolf Schimmel (Freeaqingme)'s avatar Dolf Schimmel (Freeaqingme)
Browse files

If a check fails, wait a few seconds. Only fail on subsequent failure

parent 8665ade2
No related branches found
No related tags found
No related merge requests found
......@@ -194,23 +194,35 @@ sub director_connect {
return $sock;
}
# Scan all ports on a given host
# Scan all ports on a given host. 1 == success. 0 == failure
sub scan_host {
my ($host, $weight) = @_;
my $OK = 1;
# Check non-SSL ports first
foreach my $port (@PORTS){
if (! scan_port($host, $port, 0)){
$OK = 0;
last;
sleep(3);
for (my $i=0; $i <= 3; $i++) {
if (! scan_port($host, $port, 0)){
$OK = 0;
last;
}
sleep(0.5);
}
}
}
# Skip SSL checks if standard checks indicated failure
return 0 unless $OK;
foreach my $port (@SSL_PORTS){
if (! scan_port($host, $port, 1)){
$OK = 0;
last;
sleep(3);
for (my $i=0; $i <= 3; $i++) {
if (! scan_port($host, $port, 1)){
$OK = 0;
last;
}
sleep(0.5);
}
}
}
return $OK;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment