From: Michael Wallner Date: Mon, 3 Aug 2015 11:48:28 +0000 (+0200) Subject: timeout on stdin X-Git-Tag: RELEASE_2_5_2~13 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=commitdiff_plain;h=df0b1923bc8cf7a16e3fdadb54c6bf1921381914 timeout on stdin --- diff --git a/tests/helper/pipeline.inc b/tests/helper/pipeline.inc index 942d254..a6b1699 100644 --- a/tests/helper/pipeline.inc +++ b/tests/helper/pipeline.inc @@ -10,19 +10,24 @@ function respond($client, $msg) { } serve(function($client) { + $R = array(STDIN); $W = $E = array(); + if (!stream_select($R, $W, $E, 10, 0)) { + logger("Client %d timed out", (int) $client); + return; + } $count = trim(fgets(STDIN)); - logger("Expecting %d messages", $count); + logger("Expecting %d messages from client %d", $count, (int) $client); /* the peek message */ respond($client, new http\Message($client, false)); - logger("Handled the peek request"); + logger("Handled the peek request of client %d", (int) $client); /* pipelined messages */ $req = array(); for ($i=0; $i < $count; ++ $i) { $req[] = new http\Message($client, false); - logger("Read request no. %d", $i+1); + logger("Read request no. %d from client %d", $i+1, (int) $client); } foreach ($req as $i => $msg) { respond($client, $msg); - logger("Sent response no. %d", $i+1); + logger("Sent response no. %d to client %d", $i+1, (int) $client); } });