From 12f8c095c34bbef1b5d1d06c9e5f2bb7549c4b51 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 13 May 2019 11:44:48 +0200 Subject: [PATCH] Use more callFork --- src/danog/MadelineProto/API.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/danog/MadelineProto/API.php b/src/danog/MadelineProto/API.php index 22a9a880..13ebec12 100644 --- a/src/danog/MadelineProto/API.php +++ b/src/danog/MadelineProto/API.php @@ -96,12 +96,12 @@ class API extends APIFactory if (isset($unserialized->API)) { $this->API = $unserialized->API; - $promise = $this->call((function () { + $this->callFork((function () { yield $this->API->asyncInitPromise; $this->API->asyncInitPromise = null; $this->APIFactory(); \danog\MadelineProto\Logger::log('Ping...', Logger::ULTRA_VERBOSE); - $pong = $this->ping(['ping_id' => 3], ['async' => true]); + $pong = yield $this->ping(['ping_id' => 3], ['async' => true]); \danog\MadelineProto\Logger::log('Pong: ' . $pong['ping_id'], Logger::ULTRA_VERBOSE); \danog\MadelineProto\Logger::log(\danog\MadelineProto\Lang::$current_lang['madelineproto_ready'], Logger::NOTICE); })()); @@ -119,12 +119,12 @@ class API extends APIFactory } $this->API = new MTProto($params); \danog\MadelineProto\Logger::log(\danog\MadelineProto\Lang::$current_lang['apifactory_start'], Logger::VERBOSE); - $promise = $this->call((function () { + $this->callFork((function () { yield $this->API->asyncInitPromise; $this->API->asyncInitPromise = null; $this->APIFactory(); \danog\MadelineProto\Logger::log('Ping...', Logger::ULTRA_VERBOSE); - $pong = $this->ping(['ping_id' => 3], ['async' => true]); + $pong = yield $this->ping(['ping_id' => 3], ['async' => true]); \danog\MadelineProto\Logger::log('Pong: ' . $pong['ping_id'], Logger::ULTRA_VERBOSE); \danog\MadelineProto\Logger::log(\danog\MadelineProto\Lang::$current_lang['madelineproto_ready'], Logger::NOTICE); })());