| @@ -3,7 +3,6 @@ | ||
| 3 | 3 | require __DIR__ . '/../vendor/autoload.php'; | 
| 4 | 4 | |
| 5 | 5 | use mpyw\Co\Co; | 
| 6 | -use mpyw\Co\CURLException; | |
| 7 | 6 | |
| 8 | 7 |  function curl_init_with($url, array $options = [CURLOPT_RETURNTRANSFER => true]) { | 
| 9 | 8 | $ch = curl_init($url); | 
| @@ -55,8 +55,9 @@ discard block | ||
| 55 | 55 | $con = @stream_socket_accept($socket, -1); | 
| 56 | 56 |          if (!$con) { | 
| 57 | 57 | $err = error_get_last(); // どーなんだこれ strerror(EINTR) | 
| 58 | - if (strpos($err["message"], "Interrupted system call") !== false) | |
| 59 | - continue; | |
| 58 | +            if (strpos($err["message"], "Interrupted system call") !== false) { | |
| 59 | + continue; | |
| 60 | + } | |
| 60 | 61 | fwrite(STDERR, "[Server] " . $err["message"] . "\n"); | 
| 61 | 62 | exit(1); | 
| 62 | 63 | } | 
| @@ -91,7 +92,9 @@ discard block | ||
| 91 | 92 | parse_str(isset($parsed['query']) ? $parsed['query'] : '', $q); | 
| 92 | 93 |          foreach ($endpoints as $endpoint => $action) { | 
| 93 | 94 |              if ($parsed['path'] === $endpoint || $endpoint === '') { | 
| 94 | - if ($endpoint === '') $endpoint = '[Undefined]'; | |
| 95 | +                if ($endpoint === '') { | |
| 96 | + $endpoint = '[Undefined]'; | |
| 97 | + } | |
| 95 | 98 | fwrite(STDERR, "Request: $parts[1]\n"); | 
| 96 | 99 | $action($con, $q); | 
| 97 | 100 | exit(0); | 
| @@ -323,8 +323,10 @@ | ||
| 323 | 323 | // NOTE: DO NOT call curl_multi_remove_handle | 
| 324 | 324 | // or curl_multi_add_handle while looping curl_multi_info_read! | 
| 325 | 325 | $entries = array(); | 
| 326 | -            do if ($entry = curl_multi_info_read($this->mh, $remains)) { | |
| 326 | +            do { | |
| 327 | +                if ($entry = curl_multi_info_read($this->mh, $remains)) { | |
| 327 | 328 | $entries[] = $entry; | 
| 329 | + } | |
| 328 | 330 | } while ($remains); | 
| 329 | 331 | // Remove done and consume queue. | 
| 330 | 332 |              foreach ($entries as $entry) { | 
| @@ -3,7 +3,6 @@ | ||
| 3 | 3 | require __DIR__ . '/../vendor/autoload.php'; | 
| 4 | 4 | |
| 5 | 5 | use mpyw\Co\Co; | 
| 6 | -use mpyw\Co\CURLException; | |
| 7 | 6 | |
| 8 | 7 |  function curl_init_with($url, array $options = [CURLOPT_RETURNTRANSFER => true]) { | 
| 9 | 8 | $ch = curl_init($url); |