This commit is contained in:
Daniil Gentili 2019-06-07 19:15:12 +02:00
parent 954c64127e
commit afc64ca257
3 changed files with 10 additions and 3 deletions

View File

@ -220,6 +220,7 @@ class FeedLoop extends ResumableSignalLoop
$this->API->logger->logger("Not enough data: for message update $log, getting difference...", \danog\MadelineProto\Logger::VERBOSE);
$update = ['_' => 'updateChannelTooLong'];
if ($channelId && !yield $this->API->peer_isset_async($this->API->to_supergroup($channelId))) $channelId = false;
}
break;
default:

View File

@ -922,8 +922,12 @@ class MTProto extends AsyncConstruct implements TLCallback
if (!isset($this->seqUpdater)) {
$this->seqUpdater = new SeqLoop($this);
}
$channelIds = [];
foreach ($this->channels_state->get() as $state) {
$channelId = $state->getChannel();
$channelIds []= $state->getChannel();
}
sort($channelIds);
foreach ($channelIds as $channelId) {
if (!isset($this->feeders[$channelId])) {
$this->feeders[$channelId] = new FeedLoop($this, $channelId);
}

View File

@ -132,8 +132,10 @@ class Magic
} catch (\danog\MadelineProto\Exception $e) {
}
// Even an empty handler is enough to catch ctrl+c
Loop::onSignal(SIGINT, static function () { die(); });
Loop::onSignal(SIGTERM, static function () { die(); });
if (defined('SIGINT')) {
Loop::onSignal(SIGINT, static function () { die(); });
Loop::onSignal(SIGTERM, static function () { die(); });
}
self::$inited = true;
}
}