Avoid bit width compatibility problems, fix fallback to normal session
This commit is contained in:
parent
6984893103
commit
3d9d975f79
|
@ -32,14 +32,6 @@ abstract class AbstractAPIFactory extends AsyncConstruct
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private string $namespace = '';
|
private string $namespace = '';
|
||||||
/**
|
|
||||||
* MTProto instance.
|
|
||||||
*
|
|
||||||
* @internal
|
|
||||||
*
|
|
||||||
* @var MTProto|Client
|
|
||||||
*/
|
|
||||||
public $API;
|
|
||||||
/**
|
/**
|
||||||
* Whether lua is being used.
|
* Whether lua is being used.
|
||||||
*
|
*
|
||||||
|
@ -95,7 +87,6 @@ abstract class AbstractAPIFactory extends AsyncConstruct
|
||||||
*/
|
*/
|
||||||
protected static function link(self $a, self $b): void
|
protected static function link(self $a, self $b): void
|
||||||
{
|
{
|
||||||
$a->API =& $b->API;
|
|
||||||
$a->lua =& $b->lua;
|
$a->lua =& $b->lua;
|
||||||
$a->async =& $b->async;
|
$a->async =& $b->async;
|
||||||
$a->methods =& $b->methods;
|
$a->methods =& $b->methods;
|
||||||
|
@ -187,7 +178,7 @@ abstract class AbstractAPIFactory extends AsyncConstruct
|
||||||
$aargs = isset($arguments[1]) && \is_array($arguments[1]) ? $arguments[1] : [];
|
$aargs = isset($arguments[1]) && \is_array($arguments[1]) ? $arguments[1] : [];
|
||||||
$aargs['apifactory'] = true;
|
$aargs['apifactory'] = true;
|
||||||
$args = isset($arguments[0]) && \is_array($arguments[0]) ? $arguments[0] : [];
|
$args = isset($arguments[0]) && \is_array($arguments[0]) ? $arguments[0] : [];
|
||||||
return yield from $this->API->methodCallAsyncRead($name, $args, $aargs);
|
return yield from $this->mainAPI->API->methodCallAsyncRead($name, $args, $aargs);
|
||||||
}
|
}
|
||||||
if ($lower_name === 'seteventhandler'
|
if ($lower_name === 'seteventhandler'
|
||||||
|| ($lower_name === 'loop' && !isset($arguments[0]))
|
|| ($lower_name === 'loop' && !isset($arguments[0]))
|
||||||
|
|
|
@ -23,7 +23,6 @@ final class ProcessRunner extends RunnerAbstract
|
||||||
*/
|
*/
|
||||||
public static function start(string $session, int $request): void
|
public static function start(string $session, int $request): void
|
||||||
{
|
{
|
||||||
$request = Tools::randomInt();
|
|
||||||
if (\PHP_SAPI === "cli") {
|
if (\PHP_SAPI === "cli") {
|
||||||
$binary = \PHP_BINARY;
|
$binary = \PHP_BINARY;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -96,6 +96,7 @@ use danog\MadelineProto\Tools;
|
||||||
try {
|
try {
|
||||||
Magic::classExists();
|
Magic::classExists();
|
||||||
Magic::$script_cwd = $_GET['cwd'] ?? Magic::getcwd();
|
Magic::$script_cwd = $_GET['cwd'] ?? Magic::getcwd();
|
||||||
|
|
||||||
$API = new API($ipcPath, (new Settings)->getSerialization()->setForceFull(true));
|
$API = new API($ipcPath, (new Settings)->getSerialization()->setForceFull(true));
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -112,9 +113,8 @@ use danog\MadelineProto\Tools;
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
Logger::log("Got exception $e in IPC server, exiting...", Logger::FATAL_ERROR);
|
Logger::log("Got exception $e in IPC server, exiting...", Logger::FATAL_ERROR);
|
||||||
\trigger_error("Got exception $e in IPC server, exiting...", E_USER_ERROR);
|
|
||||||
$ipc = Tools::wait($session->getIpcState());
|
$ipc = Tools::wait($session->getIpcState());
|
||||||
if (!($ipc && $ipc->getRunnerId() === $runnerId && !$ipc->getException())) {
|
if (!($ipc && $ipc->getStartupId() === $runnerId && !$ipc->getException())) {
|
||||||
Tools::wait($session->storeIpcState(new IpcState($runnerId, $e)));
|
Tools::wait($session->storeIpcState(new IpcState($runnerId, $e)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ class Server extends SignalLoop
|
||||||
*/
|
*/
|
||||||
public static function startMe(SessionPaths $session): Promise
|
public static function startMe(SessionPaths $session): Promise
|
||||||
{
|
{
|
||||||
$id = Tools::randomInt();
|
$id = Tools::randomInt(2000000000);
|
||||||
try {
|
try {
|
||||||
Logger::log("Starting IPC server $session (process)");
|
Logger::log("Starting IPC server $session (process)");
|
||||||
ProcessRunner::start($session, $id);
|
ProcessRunner::start($session, $id);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user