diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2021-08-26 00:04:49 -0400 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2021-09-08 15:06:07 -0400 |
commit | 83338cb7dd29190747619e54ef581e339fc34e8b (patch) | |
tree | c3302fbb3b28d05b0d8503c57086804c634bdfc2 /tests | |
parent | ca2898f67896be77d4556c85a536975319a99dee (diff) | |
download | lighttpd-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')
-rw-r--r-- | tests/LightyTest.pm | 14 |
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 { |