From 33483cdc47a1fe91db304380f947df0cfe97204f Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 13 Sep 2021 17:04:02 +0200 Subject: [PATCH] Small fix --- src/danog/MadelineProto/Connection.php | 2 +- .../MadelineProto/Settings/Connection.php | 28 +++++++++++++++++++ src/danog/MadelineProto/Settings/TLSchema.php | 6 ++-- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/danog/MadelineProto/Connection.php b/src/danog/MadelineProto/Connection.php index 572a89a2b..737b70c44 100644 --- a/src/danog/MadelineProto/Connection.php +++ b/src/danog/MadelineProto/Connection.php @@ -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) { diff --git a/src/danog/MadelineProto/Settings/Connection.php b/src/danog/MadelineProto/Settings/Connection.php index 53445b3b0..1f4852795 100644 --- a/src/danog/MadelineProto/Settings/Connection.php +++ b/src/danog/MadelineProto/Settings/Connection.php @@ -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. * diff --git a/src/danog/MadelineProto/Settings/TLSchema.php b/src/danog/MadelineProto/Settings/TLSchema.php index e43aba3ec..ac1db9081 100644 --- a/src/danog/MadelineProto/Settings/TLSchema.php +++ b/src/danog/MadelineProto/Settings/TLSchema.php @@ -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());