diff lib/Test/Nginx.pm @ 96:ecff5407867c

Tests: better handle unexpected connection close from nginx. Problem found when running test suite indefinitely against nginx with intentionally broken malloc().
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 08 Jun 2009 23:27:30 +0400
parents 5276d85d5040
children 9ddc18214854
line wrap: on
line diff
--- a/lib/Test/Nginx.pm
+++ b/lib/Test/Nginx.pm
@@ -254,7 +254,8 @@ sub http($;%) {
 	my ($request, %extra) = @_;
 	my $reply;
 	eval {
-		local $SIG{ALRM} = sub { die "alarm\n" };
+		local $SIG{ALRM} = sub { die "timeout\n" };
+		local $SIG{PIPE} = sub { die "sigpipe\n" };
 		alarm(2);
 		my $s = IO::Socket::INET->new(
 			Proto => 'tcp',
@@ -271,7 +272,7 @@ sub http($;%) {
 	};
 	alarm(0);
 	if ($@) {
-		log_in('(timeout)');
+		log_in("died: $@");
 		return undef;
 	}
 	return $reply;