1
0
mirror of https://github.com/danog/MadelineProto.git synced 2025-01-23 06:13:54 +01:00

Small fix

This commit is contained in:
Daniil Gentili 2021-09-13 17:03:05 +02:00
parent 78e15f0c9a
commit f3733fa40c
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -40,7 +40,7 @@ class PingLoop extends ResumableSignalLoop
$datacenter = $this->datacenter;
$connection = $this->connection;
$shared = $this->datacenterConnection;
$timeout = $shared->getSettings()->getTimeout();
$timeout = $shared->getSettings()->getPingInterval();
$timeoutMs = $timeout * 1000;
while (true) {
while (!$shared->hasTempAuthKey()) {
@ -51,7 +51,7 @@ class PingLoop extends ResumableSignalLoop
if (yield $this->waitSignal($this->pause($timeoutMs))) {
return;
}
if (\time() - $connection->getLastChunk() >= $timeout) {
if (\time() - $connection->getLastChunk() >= $timeout && $shared->hasTempAuthKey()) {
$API->logger->logger("Ping DC {$datacenter}");
try {
yield from $connection->methodCallAsyncRead('ping', ['ping_id' => \random_bytes(8)]);