summaryrefslogtreecommitdiff
path: root/tests/LightyTest.pm
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2021-08-26 00:04:49 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2021-09-08 15:06:07 -0400
commit83338cb7dd29190747619e54ef581e339fc34e8b (patch)
treec3302fbb3b28d05b0d8503c57086804c634bdfc2 /tests/LightyTest.pm
parentca2898f67896be77d4556c85a536975319a99dee (diff)
downloadlighttpd-git-83338cb7dd29190747619e54ef581e339fc34e8b.tar.gz
[tests] IO::Socket::INET->new( Timeout => 1 )
(to be used when supported by the underlying Perl lib)
Diffstat (limited to 'tests/LightyTest.pm')
-rw-r--r--tests/LightyTest.pm14
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/LightyTest.pm b/tests/LightyTest.pm
index 4595dd55..5e798bfa 100644
--- a/tests/LightyTest.pm
+++ b/tests/LightyTest.pm
@@ -92,14 +92,22 @@ sub listening_on {
my $self = shift;
my $port = shift;
+ local $@;
+ local $SIG{ALRM} = sub { };
+ eval {
+ local $SIG{ALRM} = sub { die 'alarm()'; };
+ alarm(1);
my $remote = IO::Socket::INET->new(
+ Timeout => 1,
Proto => "tcp",
PeerAddr => "127.0.0.1",
- PeerPort => $port) or return 0;
+ PeerPort => $port) || do { alarm(0); die 'socket()'; };
close $remote;
-
- return 1;
+ alarm(0);
+ };
+ alarm(0);
+ return (defined($@) && $@ eq "");
}
sub stop_proc {