mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-27 11:34:41 +01:00
Final fix
This commit is contained in:
parent
f9e5d7be36
commit
3b8301217f
@ -23,6 +23,7 @@ use danog\MadelineProto\Logger;
|
||||
use danog\MadelineProto\Magic;
|
||||
use danog\MadelineProto\SessionPaths;
|
||||
use danog\MadelineProto\Settings\Ipc;
|
||||
use danog\MadelineProto\Shutdown;
|
||||
use danog\MadelineProto\Tools;
|
||||
|
||||
(static function (): void {
|
||||
@ -108,6 +109,7 @@ use danog\MadelineProto\Tools;
|
||||
try {
|
||||
Tools::wait($session->storeIpcState(new IpcState($runnerId)));
|
||||
Tools::wait(Server::waitShutdown());
|
||||
Shutdown::removeCallback('restarter');
|
||||
return;
|
||||
} catch (\Throwable $e) {
|
||||
Logger::log((string) $e, Logger::FATAL_ERROR);
|
||||
|
@ -72,14 +72,13 @@ trait Loop
|
||||
$url = \explode('?', $uri, 2)[0] ?? '';
|
||||
$query = \http_build_query($params);
|
||||
$uri = \implode('?', [$url, $query]);
|
||||
$payload = $_SERVER['REQUEST_METHOD'].' '.$uri.' '.$_SERVER['SERVER_PROTOCOL']."\r\n".'Host: '.$_SERVER['SERVER_NAME']."\r\n\r\n";
|
||||
$payload = $_SERVER['REQUEST_METHOD'].' '.$uri." HTTP/1.1\r\n".'Host: '.$_SERVER['SERVER_NAME']."\r\n\r\n";
|
||||
$logger->logger("Connecting to {$address}:{$port}");
|
||||
$a = \fsockopen($address, $port);
|
||||
$logger->logger("Sending self-restart payload");
|
||||
$logger->logger($payload);
|
||||
\fwrite($a, $payload);
|
||||
$logger->logger("Payload sent with token {$params['MadelineSelfRestart']}, waiting for self-restart");
|
||||
\sleep(10);
|
||||
\fclose($a);
|
||||
$logger->logger("Shutdown of self-restart callback");
|
||||
}, 'restarter');
|
||||
|
Loading…
Reference in New Issue
Block a user