diff --git a/composer.json b/composer.json index bfb4ec0..a40af31 100644 --- a/composer.json +++ b/composer.json @@ -13,9 +13,11 @@ "require": { "php": "^5.5 || ^7.0", "php-http/httplug": "^1.0", - "react/http-client": "^0.4.8 || ^0.5", - "react/dns": "^0.4.1", - "react/socket": "^0.8", + "react/http-client": "~0.5.9", + "react/dns": "^0.4.15", + "react/socket": "^1.0", + "react/stream": "^1.0", + "react/event-loop": "^1.0", "php-http/discovery": "^1.0" }, "require-dev": { diff --git a/src/Promise.php b/src/Promise.php index 2c4cbd5..ac629a8 100644 --- a/src/Promise.php +++ b/src/Promise.php @@ -175,8 +175,12 @@ public function getState() */ public function wait($unwrap = true) { + $loop = $this->loop; while (HttpPromise::PENDING === $this->getState()) { - $this->loop->tick(); + $loop->futureTick(function () use ($loop) { + $loop->stop(); + }); + $loop->run(); } if ($unwrap) {