git://git.jankratochvil.net
/
nethome.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
8a47384
)
bin/checkhello: update
author
root
<jan.kratochvil@redhat.com>
Tue, 25 Feb 2020 09:32:39 +0000
(10:32 +0100)
committer
root
<jan.kratochvil@redhat.com>
Tue, 25 Feb 2020 09:32:39 +0000
(10:32 +0100)
bin/checkhello
patch
|
blob
|
history
diff --git
a/bin/checkhello
b/bin/checkhello
index
c6eba95
..
1998e19
100755
(executable)
--- a/
bin/checkhello
+++ b/
bin/checkhello
@@
-3,21
+3,25
@@
use strict;
use warnings;
use IO::Socket::INET6;
use Time::HiRes qw(sleep);
use warnings;
use IO::Socket::INET6;
use Time::HiRes qw(sleep);
+use POSIX;
@ARGV==5 or die "$0 <hostname> <port> <string> <timeout> <tries>";
my($hostname,$port,$string,$timeout,$tries)=@ARGV;
@ARGV==5 or die "$0 <hostname> <port> <string> <timeout> <tries>";
my($hostname,$port,$string,$timeout,$tries)=@ARGV;
-for our $try (1..$tries) {
- sub ts() {
- return localtime()." PID=$$ #$try: ";
- }
+our $try;
+sub ts() {
+ return localtime()." PID=$$ #$try: ";
+}
+for $try (1..$tries) {
warn ts()."connect($hostname,$port)...\n";
my $sock=IO::Socket::INET6->new(
"Proto" =>"tcp",
"PeerAddr"=>$hostname,
"PeerPort"=>$port,
warn ts()."connect($hostname,$port)...\n";
my $sock=IO::Socket::INET6->new(
"Proto" =>"tcp",
"PeerAddr"=>$hostname,
"PeerPort"=>$port,
+ "Timeout"=>$timeout,
);
if (!$sock) {
);
if (!$sock) {
- warn ts()."connect($hostname,$port)=$!";
- sleep $timeout;
+ my $e=$!+0;
+ warn ts()."connect($hostname,$port)=$e=$!";
+ sleep $timeout if $e!=ETIMEDOUT;
next;
}
warn ts()."connect($hostname,$port): done.\n";
next;
}
warn ts()."connect($hostname,$port): done.\n";
@@
-63,5
+67,6
@@
for our $try (1..$tries) {
warn ts()."buf=<$buf>, sleep $remains";
sleep $remains or warn ts()."sleep=$!";
}
warn ts()."buf=<$buf>, sleep $remains";
sleep $remains or warn ts()."sleep=$!";
}
+$try=$tries;
warn ts()."FAIL\n";
print "FAIL\n";
warn ts()."FAIL\n";
print "FAIL\n";