Use http_wait instead of ping to wakeup closed sockets, add debugging phar creation script
This commit is contained in:
parent
d5fe532e22
commit
bbe24e70d9
@ -72,7 +72,11 @@ trait MessageHandler
|
||||
{
|
||||
if ($this->datacenter->sockets[$datacenter]->must_open) {
|
||||
\danog\MadelineProto\Logger::log(['Trying to read from closed socket, sending initial ping']);
|
||||
$this->method_call('ping', ['ping_id' => 0], ['datacenter' => $datacenter]);
|
||||
if ($this->is_http($datacenter)) {
|
||||
$this->method_call('http_wait', ['max_wait' => 500, 'wait_after' => 150, 'max_delay' => 500], ['datacenter' => $datacenter]);
|
||||
} else {
|
||||
$this->method_call('ping', ['ping_id' => 0], ['datacenter' => $datacenter]);
|
||||
}
|
||||
}
|
||||
$payload = $this->datacenter->sockets[$datacenter]->read_message();
|
||||
if (strlen($payload) === 4) {
|
||||
|
37
tests/makephardebug.sh
Executable file
37
tests/makephardebug.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
composer global require spatie/7to5
|
||||
[ -f $HOME/.composer/vendor/bin/php7to5 ] && php7to5=$HOME/.composer/vendor/bin/php7to5
|
||||
[ -f $HOME/.config/composer/vendor/bin/php7to5 ] && php7to5=$HOME/.config/composer/vendor/bin/php7to5
|
||||
|
||||
rm -rf phar7 phar5 MadelineProtoPhar
|
||||
|
||||
mkdir phar7
|
||||
cd phar7
|
||||
echo '{
|
||||
"name": "danog/madelineprototests",
|
||||
"minimum-stability":"dev",
|
||||
"require": {
|
||||
"danog/madelineproto": "dev-master"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://github.com/danog/phpseclib"
|
||||
}
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Daniil Gentili",
|
||||
"email": "daniil@daniil.it"
|
||||
}
|
||||
]
|
||||
}' > composer.json
|
||||
composer update
|
||||
cp -a ../src vendor/danog/madelineproto
|
||||
cd ..
|
||||
|
||||
$php7to5 convert --copy-all phar7 phar5 >/dev/null
|
||||
|
||||
php makephar.php phar5 madeline.phar $(cat .git/refs/heads/master)
|
||||
|
Loading…
Reference in New Issue
Block a user