Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Harden test against race.
  • Loading branch information
jnthn committed Dec 16, 2015
1 parent ad0164f commit b2394b1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion S32-io/socket-recv-vs-read.t
Expand Up @@ -19,7 +19,11 @@ IO::Socket::Async.listen($hostname, $port).tap(-> $conn {
});

$send-rest = Promise.new;
$client = IO::Socket::INET.new(:host("$hostname:$port"));
for ^10 {
$client = IO::Socket::INET.new(:host("$hostname:$port"));
last;
CATCH { default { sleep 0.2; } }
}
is $client.recv, 'first thing', 'can recv immediately with recv (chars)';
$send-rest.keep(True);
is $client.recv, 'another thing', 'can recv rest afterwards (chars)';
Expand Down

0 comments on commit b2394b1

Please sign in to comment.