Avoid closing connection if in worker

This commit is contained in:
Daniil Gentili 2020-09-28 17:54:36 +02:00
parent e5c430dfc9
commit f18e197319
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
1 changed files with 2 additions and 1 deletions

View File

@ -20,6 +20,7 @@
namespace danog\MadelineProto\Wrappers;
use Amp\Promise;
use danog\MadelineProto\Magic;
use danog\MadelineProto\Settings;
use danog\MadelineProto\Shutdown;
@ -180,7 +181,7 @@ trait Loop
*/
public function closeConnection($message = 'OK!')
{
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg' || isset($GLOBALS['exited']) || \headers_sent()) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg' || isset($GLOBALS['exited']) || \headers_sent() || isset($_GET['MadelineSelfRestart']) || Magic::$isIpcWorker) {
return;
}
$this->logger->logger($message);