1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 10:34:38 +01:00

Do not unreference timeout watcher

This commit is contained in:
Daniil Gentili 2020-11-16 11:53:29 +01:00
parent 9ea5a763a7
commit 2bac25d8cb
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -305,6 +305,7 @@ abstract class Tools extends StrTools
$resolved = false; $resolved = false;
do { do {
try { try {
Logger::log("Starting event loop...");
Loop::run(function () use (&$resolved, &$value, &$exception, $promise) { Loop::run(function () use (&$resolved, &$value, &$exception, $promise) {
$promise->onResolve(function ($e, $v) use (&$resolved, &$value, &$exception) { $promise->onResolve(function ($e, $v) use (&$resolved, &$value, &$exception) {
Loop::stop(); Loop::stop();
@ -405,7 +406,7 @@ abstract class Tools extends StrTools
$deferred = null; $deferred = null;
$temp->fail(new TimeoutException); $temp->fail(new TimeoutException);
}); });
Loop::unreference($watcher); //Loop::unreference($watcher);
$promise->onResolve(function () use (&$deferred, $promise, $watcher) { $promise->onResolve(function () use (&$deferred, $promise, $watcher) {
if ($deferred !== null) { if ($deferred !== null) {
@ -449,7 +450,7 @@ abstract class Tools extends StrTools
$deferred = null; $deferred = null;
$temp->resolve($default); $temp->resolve($default);
}); });
Loop::unreference($watcher); //Loop::unreference($watcher);
$promise->onResolve(function () use (&$deferred, $promise, $watcher) { $promise->onResolve(function () use (&$deferred, $promise, $watcher) {
if ($deferred !== null) { if ($deferred !== null) {