1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 07:18:57 +01:00

Persist more state

This commit is contained in:
Daniil Gentili 2023-12-17 17:03:13 +01:00
parent 8cc9685433
commit 8f30dad5d1
4 changed files with 17 additions and 1 deletions

View File

@ -75,6 +75,10 @@ final class FeedLoop extends Loop
$this->parsedUpdates->setIteratorMode(SplQueue::IT_MODE_DELETE);
$this->init($API);
}
public function __sleep()
{
return ['channelId', 'incomingUpdates', 'parsedUpdates', 'updater', 'state', 'API'];
}
/**
* Main loop.
*/

View File

@ -64,6 +64,10 @@ final class SeqLoop extends Loop
$this->incomingUpdates->setIteratorMode(SplQueue::IT_MODE_DELETE);
$this->init($API);
}
public function __sleep()
{
return ['incomingUpdates', 'feeder', 'pendingWakeups', 'state', 'API'];
}
/**
* Main loop.
*/

View File

@ -71,6 +71,10 @@ final class UpdateLoop extends Loop
$this->init($API);
$this->channelId = $channelId;
}
public function __sleep(): array
{
return ['channelId', 'feeder', 'API'];
}
private ?DeferredFuture $done = null;
public function resumeAndWait(): void
{

View File

@ -657,6 +657,10 @@ final class MTProto implements TLCallback, LoggerGetter, SettingsGetter
'calls',
'callsByPeer',
'snitch',
'seqUpdater',
'updaters',
'feeders',
];
}
@ -1836,7 +1840,7 @@ final class MTProto implements TLCallback, LoggerGetter, SettingsGetter
[
'InputFileLocation' => $this->getDownloadInfo(...),
'InputPeer' => $this->getInputPeer(...),
'InputDialogPeer' => fn (mixed $id) => ['_' => 'inputDialogPeer', 'peer' => $this->getInputPeer($id)],
'InputDialogPeer' => fn (mixed $id): array => ['_' => 'inputDialogPeer', 'peer' => $this->getInputPeer($id)],
'InputCheckPasswordSRP' => fn (string $password): array => (new PasswordCalculator($this->methodCallAsyncRead('account.getPassword', [], $this->authorized_dc)))->getCheckPassword($password),
],
);