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

Shutdown wrappers, too

This commit is contained in:
Daniil Gentili 2020-09-25 21:21:17 +02:00
parent d558d17d1f
commit 5779732cd0
2 changed files with 6 additions and 3 deletions

View File

@ -118,10 +118,11 @@ abstract class ClientAbstract
* *
* @return Promise * @return Promise
*/ */
public function disconnect(): Promise public function disconnect(): \Generator
{ {
$this->run = false; $this->run = false;
return $this->server->disconnect(); yield $this->server->disconnect();
yield \array_map(fn (ChannelledSocket $w): Promise => $w->disconnect(), $this->wrappers);
} }
/** /**
* Call function. * Call function.

View File

@ -144,7 +144,9 @@ class Server extends SignalLoop
Tools::callFork($this->clientLoop($socket)); Tools::callFork($this->clientLoop($socket));
} }
$this->server->close(); $this->server->close();
if (isset($this->callback)) $this->callback->signal(null); if (isset($this->callback)) {
$this->callback->signal(null);
}
} }
/** /**
* Client handler loop. * Client handler loop.