From b38c3cc9356e9cc8341caf127a1187ba95cc2735 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 3 Dec 2025 14:10:42 +0200 Subject: [PATCH] gotd: invoke with layer every time Cherry-picked from upstream PR 1640. The reason is that tracking whether the Telegram servers received our layer number is hard, so it's more reliable to just always send it. --- pkg/gotd/telegram/internal/manager/conn.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/gotd/telegram/internal/manager/conn.go b/pkg/gotd/telegram/internal/manager/conn.go index 5731d3e7..e7746d27 100644 --- a/pkg/gotd/telegram/internal/manager/conn.go +++ b/pkg/gotd/telegram/internal/manager/conn.go @@ -167,7 +167,13 @@ func (c *Conn) Invoke(ctx context.Context, input bin.Encoder, output bin.Decoder return errors.Wrap(err, "waitSession") } - return c.proto.Invoke(ctx, c.wrapRequest(noopDecoder{input}), output) + q := c.wrapRequest(noopDecoder{input}) + req := c.wrapRequest(&tg.InvokeWithLayerRequest{ + Layer: tg.Layer, + Query: q, + }) + + return c.proto.Invoke(ctx, req, output) } // OnMessage implements mtproto.Handler.