This commit is contained in:
Daniil Gentili 2019-06-07 17:21:43 +02:00
parent 53b72c8a29
commit 24b92b9a71
6 changed files with 14 additions and 12 deletions

View File

@ -65,6 +65,7 @@ Tip: if you receive an error (or nothing), [send us](https://t.me/pwrtelegramgro
* [Async in callback handler](https://docs.madelineproto.xyz/docs/ASYNC.html#async-in-callback-handler)
* [Wrapped async](https://docs.madelineproto.xyz/docs/ASYNC.html#wrapped-async)
* [Multiple async](https://docs.madelineproto.xyz/docs/ASYNC.html#multiple-async)
* [ArrayAccess async](https://docs.madelineproto.xyz/docs/ASYNC.html#arrayaccess-async)
* [Ignored async](https://docs.madelineproto.xyz/docs/ASYNC.html#ignored-async)
* [Blocking async](https://docs.madelineproto.xyz/docs/ASYNC.html#blocking-async)
* [MadelineProto and AMPHP async APIs](https://docs.madelineproto.xyz/docs/ASYNC.html#madelineproto-and-amphp-async-apis)

View File

@ -19,6 +19,7 @@
"ext-mbstring": "*",
"ext-json": "*",
"ext-xml": "*",
"ext-fileinfo": "*",
"amphp/amp": "^2.0",
"amphp/socket": "^0.10.11",
"amphp/websocket": "dev-master",

2
docs

@ -1 +1 @@
Subproject commit dc05dc5cebfcec90ac7851928c522a4d635dbab6
Subproject commit dbb560f13e9c15c7bfc96c7ae44bb3ae74c75fe7

View File

@ -228,20 +228,11 @@ class CombinedAPI
if (is_callable($max_forks)) {
return $this->wait($max_forks());
}
if (php_sapi_name() !== 'cli') {
try {
set_time_limit(-1);
} catch (\danog\MadelineProto\Exception $e) {
register_shutdown_function(function () {
\danog\MadelineProto\Logger::log(['Restarting script...']);
$a = fsockopen((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] ? 'tls' : 'tcp').'://'.$_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT']);
fwrite($a, $_SERVER['REQUEST_METHOD'].' '.$_SERVER['REQUEST_URI'].' '.$_SERVER['SERVER_PROTOCOL']."\r\n".'Host: '.$_SERVER['SERVER_NAME']."\r\n\r\n");
});
}
}
$loops = [];
foreach ($this->instances as $path => $instance) {
$this->wait($instance->initAsync());
$this->wait($instance->API->initAsync());
if ($instance->API->authorized !== MTProto::LOGGED_IN) {
continue;
}

View File

@ -169,6 +169,9 @@ class MTProto extends AsyncConstruct implements TLCallback
if (!extension_loaded('xml')) {
throw new Exception(['extension', 'xml']);
}
if (!extension_loaded('fileinfo')) {
throw new Exception(['extension', 'fileinfo']);
}
if (!extension_loaded('json')) {
throw new Exception(['extension', 'json']);
}
@ -279,6 +282,9 @@ class MTProto extends AsyncConstruct implements TLCallback
if (!extension_loaded('xml')) {
throw new Exception(['extension', 'xml']);
}
if (!extension_loaded('fileinfo')) {
throw new Exception(['extension', 'fileinfo']);
}
if (!extension_loaded('mbstring')) {
throw new Exception(['extension', 'mbstring']);
}

View File

@ -130,6 +130,9 @@ class Magic
self::$can_getcwd = true;
} catch (\danog\MadelineProto\Exception $e) {
}
if (function_exists('\pcntl_async_signals')) {
pcntl_async_signals(true);
}
self::$inited = true;
}
}