function once() {
echo "O";
- foreach ($this->W as $w) {
+ foreach ($this->W as $w) if (is_resource($w)) {
call_user_func($this->run, $this->client, $w, self::POLL_OUT);
}
- foreach ($this->R as $r) {
+ foreach ($this->R as $r) if (is_resource($r)) {
call_user_func($this->run, $this->client, $r, self::POLL_IN);
}
return count($this->client);
http\Exception\RuntimeException: http\Client::dequeue(): Could not dequeue request while executing callbacks in %sgh-issue50.php:9
Stack trace:
#0 %sgh-issue50.php(9): http\Client->dequeue(Object(http\Client\Request))
-#1 [internal function]: {closure}(Object(http\Client), Object(http\Client\Request), 18, 'GET / HTTP/1.1%s...')
+#1 [internal function]: {closur%s}(Object(http\Client), Object(http\Client\Request), 18, 'GET / HTTP/1.1%s...')
#2 %sgh-issue50.php(14): http\Client->send()
#3 {main}
===DONE===
logger("serve: Using port %d", $port);
do {
$R = array($server); $W = array(); $E = array();
- $select = stream_select($R, $E, $E, 10, 0);
+ $select = stream_select($R, $E, $E, 1, 0);
if ($select && ($client = stream_socket_accept($server, 1))) {
logger("serve: Accept client %d", (int) $client);
if (getenv("PHP_HTTP_TEST_SSL")) {