Bugfixes and improvements to tests
This commit is contained in:
parent
9668727b80
commit
8cd870366a
@ -479,6 +479,9 @@ class MTProto extends AsyncConstruct implements TLCallback
|
||||
if ($this->phoneConfigWatcherId) {
|
||||
Loop::cancel($this->phoneConfigWatcherId);
|
||||
}
|
||||
if (isset($this->seqUpdater)) {
|
||||
$this->seqUpdater->signal(true);
|
||||
}
|
||||
$channelIds = [];
|
||||
foreach ($this->channels_state->get() as $state) {
|
||||
$channelIds[] = $state->getChannel();
|
||||
@ -492,9 +495,6 @@ class MTProto extends AsyncConstruct implements TLCallback
|
||||
$this->updaters[$channelId]->signal(true);
|
||||
}
|
||||
}
|
||||
if (isset($this->seqUpdater)) {
|
||||
$this->seqUpdater->signal(true);
|
||||
}
|
||||
foreach ($this->datacenter->sockets as $datacenter) {
|
||||
$datacenter->disconnect();
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ trait Tools
|
||||
}
|
||||
public static function readLine($prompt = '')
|
||||
{
|
||||
return self::call(self::readLineAsync($prompt));
|
||||
return self::call(Tools::readLineAsync($prompt));
|
||||
}
|
||||
public static function readLineAsync($prompt = '')
|
||||
{
|
||||
@ -366,7 +366,6 @@ trait Tools
|
||||
$lines[count($lines) - 1] .= array_shift($chunk);
|
||||
$lines = array_merge($lines, $chunk);
|
||||
}
|
||||
|
||||
return array_shift($lines);
|
||||
}
|
||||
|
||||
|
@ -98,10 +98,11 @@ trait Loop
|
||||
fclose($lock);
|
||||
});
|
||||
if ($needs_restart) {
|
||||
Shutdown::addCallback(function () {
|
||||
$logger = &$this->logger;
|
||||
Shutdown::addCallback(static function () use (&$logger) {
|
||||
$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");
|
||||
$this->logger->logger('Self-restarted');
|
||||
$logger->logger('Self-restarted');
|
||||
}, 'restarter');
|
||||
}
|
||||
|
||||
|
@ -57,9 +57,19 @@ php makephar.php $HOME/phar5 "madeline$branch.phar" $TRAVIS_COMMIT
|
||||
export TRAVIS_PHAR="madeline$branch.phar"
|
||||
export TEST_SECRET_CHAT=test
|
||||
export TEST_USERNAME=danogentili
|
||||
export TEST_DESTINATION_GROUPS='["@pwrtelegramgroupita"]'
|
||||
export TEST_DESTINATION_GROUPS='["@danogentili"]'
|
||||
|
||||
tests/testing.php
|
||||
tests/testing.php <<EOF
|
||||
m
|
||||
$API_ID
|
||||
$API_HASH
|
||||
b
|
||||
$BOT_TOKEN
|
||||
n
|
||||
n
|
||||
n
|
||||
|
||||
EOF
|
||||
|
||||
eval "$(ssh-agent -s)"
|
||||
echo -e "$private_key" > madeline_rsa
|
||||
|
@ -49,14 +49,7 @@ $settings = json_decode(getenv('MTPROTO_SETTINGS'), true) ?: [];
|
||||
echo 'Loading MadelineProto...'.PHP_EOL;
|
||||
$MadelineProto = new \danog\MadelineProto\API(getcwd().'/testing.madeline', $settings);
|
||||
|
||||
/*
|
||||
* If a BOT_TOKEN is defined in .env, use it to login, else prompt for login info
|
||||
*/
|
||||
if (getenv('BOT_TOKEN') == '') {
|
||||
$MadelineProto->start();
|
||||
} else {
|
||||
$MadelineProto->bot_login(getenv('BOT_TOKEN'));
|
||||
}
|
||||
$MadelineProto->start();
|
||||
|
||||
try {
|
||||
$MadelineProto->get_self();
|
||||
|
Loading…
Reference in New Issue
Block a user