Avoid bit width compatibility problems, fix fallback to normal session

This commit is contained in:
Daniil Gentili 2020-09-25 10:26:10 +02:00
parent 6984893103
commit 3d9d975f79
4 changed files with 4 additions and 14 deletions

View File

@ -32,14 +32,6 @@ abstract class AbstractAPIFactory extends AsyncConstruct
* @var string
*/
private string $namespace = '';
/**
* MTProto instance.
*
* @internal
*
* @var MTProto|Client
*/
public $API;
/**
* Whether lua is being used.
*
@ -95,7 +87,6 @@ abstract class AbstractAPIFactory extends AsyncConstruct
*/
protected static function link(self $a, self $b): void
{
$a->API =& $b->API;
$a->lua =& $b->lua;
$a->async =& $b->async;
$a->methods =& $b->methods;
@ -187,7 +178,7 @@ abstract class AbstractAPIFactory extends AsyncConstruct
$aargs = isset($arguments[1]) && \is_array($arguments[1]) ? $arguments[1] : [];
$aargs['apifactory'] = true;
$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'
|| ($lower_name === 'loop' && !isset($arguments[0]))

View File

@ -23,7 +23,6 @@ final class ProcessRunner extends RunnerAbstract
*/
public static function start(string $session, int $request): void
{
$request = Tools::randomInt();
if (\PHP_SAPI === "cli") {
$binary = \PHP_BINARY;
} else {

View File

@ -96,6 +96,7 @@ use danog\MadelineProto\Tools;
try {
Magic::classExists();
Magic::$script_cwd = $_GET['cwd'] ?? Magic::getcwd();
$API = new API($ipcPath, (new Settings)->getSerialization()->setForceFull(true));
while (true) {
@ -112,9 +113,8 @@ use danog\MadelineProto\Tools;
}
} catch (\Throwable $e) {
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());
if (!($ipc && $ipc->getRunnerId() === $runnerId && !$ipc->getException())) {
if (!($ipc && $ipc->getStartupId() === $runnerId && !$ipc->getException())) {
Tools::wait($session->storeIpcState(new IpcState($runnerId, $e)));
}
}

View File

@ -73,7 +73,7 @@ class Server extends SignalLoop
*/
public static function startMe(SessionPaths $session): Promise
{
$id = Tools::randomInt();
$id = Tools::randomInt(2000000000);
try {
Logger::log("Starting IPC server $session (process)");
ProcessRunner::start($session, $id);