changeset 1705:99a9b8b50f21

Tests: fixed grpc.t TODO hang on win32. The eval + alarm model was replaced with non-blocking I/O for the same reasons as in d0025a0dead7.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 21 Jun 2021 12:44:38 +0300
parents 4b808861a318
children 9c79f41fdf9b
files grpc.t
diffstat 1 files changed, 4 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/grpc.t
+++ b/grpc.t
@@ -719,17 +719,11 @@ sub grpc {
 			{ name => 'te', value => 'trailers', mode => 2 }]});
 
 		if (!$extra{reuse}) {
-			eval {
-				local $SIG{ALRM} = sub { die "timeout\n" };
-				alarm(5);
-
-				$client = $server->accept() or return;
+			if (IO::Select->new($server)->can_read(5)) {
+				$client = $server->accept();
 
-				alarm(0);
-			};
-			alarm(0);
-			if ($@) {
-				log_in("died: $@");
+			} else {
+				log_in("timeout");
 				# connection could be unexpectedly reused
 				goto reused if $client;
 				return undef;