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
*/
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.

View File

@ -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.