From d79fca4bed28df1a91b387fcf6b4704f05a9048e Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 10 Dec 2024 17:58:03 +0000 Subject: [PATCH] Cleanup --- src/MTProto/MTProtoIncomingMessage.php | 1 + src/MTProtoSession/ResponseHandler.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/MTProto/MTProtoIncomingMessage.php b/src/MTProto/MTProtoIncomingMessage.php index 1bd4f76ea..558e99d6f 100644 --- a/src/MTProto/MTProtoIncomingMessage.php +++ b/src/MTProto/MTProtoIncomingMessage.php @@ -136,6 +136,7 @@ final class MTProtoIncomingMessage extends MTProtoMessage */ public function ack(): void { + unset($this->connection->incoming_messages[$this->msgId]); $this->state |= self::STATE_ACKED; if ($this->contentRelated) { // I let the server know that I received its message diff --git a/src/MTProtoSession/ResponseHandler.php b/src/MTProtoSession/ResponseHandler.php index 39dec0046..dba3762fa 100644 --- a/src/MTProtoSession/ResponseHandler.php +++ b/src/MTProtoSession/ResponseHandler.php @@ -148,7 +148,7 @@ trait ResponseHandler $tmp->setIteratorMode(SplQueue::IT_MODE_DELETE); foreach ($message->read()['messages'] as $msg) { $this->msgIdHandler->checkIncomingMessageId($msg['msg_id'], true); - $newMessage = new MTProtoIncomingMessage($this->connection, $msg['body'], $msg['msg_id'], $message->unencrypted, true); + $newMessage = new MTProtoIncomingMessage($this, $msg['body'], $msg['msg_id'], $message->unencrypted, true); $newMessage->setSeqNo($msg['seqno']); $this->checkInSeqNo($newMessage); $newMessage->setSeqNo(null); @@ -167,7 +167,7 @@ trait ResponseHandler $this->incoming_messages[$referencedMsgId]->ack(); } else { $this->msgIdHandler->checkIncomingMessageId($referencedMsgId, true); - $message = new MTProtoIncomingMessage($this->connection, $content['orig_message'], $referencedMsgId, $message->unencrypted); + $message = new MTProtoIncomingMessage($this, $content['orig_message'], $referencedMsgId, $message->unencrypted); $this->incomingCtr?->inc(); $this->incoming_messages[$referencedMsgId] = $message; $this->handleMessages([$message]);