diff --git a/composer.json b/composer.json index f3fe4e46b..14f330610 100644 --- a/composer.json +++ b/composer.json @@ -50,7 +50,7 @@ "league/uri": "^7", "danog/ipc": "^1", "amphp/log": "^2", - "danog/loop": "^1", + "danog/loop": "^1.1.0", "phpseclib/phpseclib": "^3.0.22", "amphp/redis": "^2", "psr/http-factory": "^1.0", diff --git a/src/Connection.php b/src/Connection.php index 2b76499dd..afa34e5c7 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -516,8 +516,8 @@ final class Connection unset($body); } $this->pendingOutgoing[$this->pendingOutgoingKey++] = $message; - if ($flush && isset($this->writer)) { - $this->writer->resume(); + if ($flush) { + $this->flush(); } $this->connect(); $promise->await(); diff --git a/src/MTProtoSession/CallHandler.php b/src/MTProtoSession/CallHandler.php index 93b471dbd..7632b31f1 100644 --- a/src/MTProtoSession/CallHandler.php +++ b/src/MTProtoSession/CallHandler.php @@ -148,7 +148,7 @@ trait CallHandler $promises[] = async($this->methodCallAsyncWrite(...), $method, $single_args, $new_aargs); } if (!isset($aargs['postpone'])) { - $this->writer->resume(); + $this->flush(); } return new WrappedFuture(async(fn () => \array_map( fn (WrappedFuture $f) => $f->await(), diff --git a/src/MTProtoSession/ResponseHandler.php b/src/MTProtoSession/ResponseHandler.php index 58a230ef5..5a654bafe 100644 --- a/src/MTProtoSession/ResponseHandler.php +++ b/src/MTProtoSession/ResponseHandler.php @@ -162,7 +162,7 @@ trait ResponseHandler } $this->new_incoming = []; if ($this->pendingOutgoing) { - $this->writer->resume(); + $this->flush(); } } /**