From 5779732cd066c184621dd0b3b40f94eb0ea9e249 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Fri, 25 Sep 2020 21:21:17 +0200 Subject: [PATCH] Shutdown wrappers, too --- src/danog/MadelineProto/Ipc/ClientAbstract.php | 5 +++-- src/danog/MadelineProto/Ipc/Server.php | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/danog/MadelineProto/Ipc/ClientAbstract.php b/src/danog/MadelineProto/Ipc/ClientAbstract.php index aa0afa76..d52c785b 100644 --- a/src/danog/MadelineProto/Ipc/ClientAbstract.php +++ b/src/danog/MadelineProto/Ipc/ClientAbstract.php @@ -118,10 +118,11 @@ abstract class ClientAbstract * * @return Promise */ - public function disconnect(): Promise + public function disconnect(): \Generator { $this->run = false; - return $this->server->disconnect(); + yield $this->server->disconnect(); + yield \array_map(fn (ChannelledSocket $w): Promise => $w->disconnect(), $this->wrappers); } /** * Call function. diff --git a/src/danog/MadelineProto/Ipc/Server.php b/src/danog/MadelineProto/Ipc/Server.php index df403f8f..74f93a28 100644 --- a/src/danog/MadelineProto/Ipc/Server.php +++ b/src/danog/MadelineProto/Ipc/Server.php @@ -144,7 +144,9 @@ class Server extends SignalLoop Tools::callFork($this->clientLoop($socket)); } $this->server->close(); - if (isset($this->callback)) $this->callback->signal(null); + if (isset($this->callback)) { + $this->callback->signal(null); + } } /** * Client handler loop.