1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 07:34:41 +01:00

Small fix

This commit is contained in:
Daniil Gentili 2021-09-13 17:04:02 +02:00
parent f3733fa40c
commit 33483cdc47
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
3 changed files with 32 additions and 4 deletions

View File

@ -347,7 +347,7 @@ class Connection
if (!isset($this->waiter)) {
$this->waiter = new HttpWaitLoop($this);
}
if (!isset($this->pinger)) { // && ($this->ctx->hasStreamName(WssStream::class) || $this->ctx->hasStreamName(WsStream::class))) {
if (!isset($this->pinger) && !$this->ctx->isMedia()) { // && ($this->ctx->hasStreamName(WssStream::class) || $this->ctx->hasStreamName(WsStream::class))) {
$this->pinger = new PingLoop($this);
}
foreach ($this->new_outgoing as $message_id => $message) {

View File

@ -83,6 +83,10 @@ class Connection extends SettingsAbstract
* Connection timeout.
*/
protected int $timeout = 2;
/**
* Ping interval.
*/
protected int $pingInterval = 10;
/**
* Whether to retry connection.
@ -667,6 +671,30 @@ class Connection extends SettingsAbstract
return $this;
}
/**
* Get ping interval.
*
* @return int
*/
public function getPingInterval(): int
{
return $this->pingInterval;
}
/**
* Set ping interval.
*
* @param int $pingInterval Ping interval
*
* @return self
*/
public function setPingInterval(int $pingInterval): self
{
$this->pingInterval = $pingInterval;
return $this;
}
/**
* Get whether to use DNS over HTTPS.
*

View File

@ -12,7 +12,7 @@ class TLSchema extends SettingsAbstract
/**
* TL layer version.
*/
protected int $layer = 131;
protected int $layer = 133;
/**
* MTProto schema path.
*/
@ -20,7 +20,7 @@ class TLSchema extends SettingsAbstract
/**
* API schema path.
*/
protected string $APISchema = __DIR__.'/../TL_telegram_v131.tl';
protected string $APISchema = __DIR__.'/../TL_telegram_v133.tl';
/**
* Secret schema path.
*/
@ -57,7 +57,7 @@ class TLSchema extends SettingsAbstract
public function __wakeup()
{
if (!\file_exists($this->APISchema) // Scheme was upgraded
|| $this->APISchema !== __DIR__.'/../TL_telegram_v131.tl' // Session path has changed
|| $this->APISchema !== __DIR__.'/../TL_telegram_v133.tl' // Session path has changed
) {
$new = new self;
$this->setAPISchema($new->getAPISchema());