From ec271baab04db816c646ba1382de288c16295b64 Mon Sep 17 00:00:00 2001 From: Alexey Dolotov Date: Sun, 29 Mar 2026 16:59:30 +0300 Subject: [PATCH 1/2] fix: apply idle timeout to Telegram relay Wrap both sides of the Telegram relay in connIdleTimeout, same as already done for domain fronting in #416. Without this, if a client disappears (network drop, battery dies), the TCP connection stays formally alive and the goroutine in the worker pool blocks on io.CopyBuffer indefinitely. Under mass client disconnects this accumulates zombie goroutines. Fixes #417 --- mtglib/proxy.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mtglib/proxy.go b/mtglib/proxy.go index fe5eb8d..8a904ee 100644 --- a/mtglib/proxy.go +++ b/mtglib/proxy.go @@ -105,8 +105,8 @@ func (p *Proxy) ServeConn(conn essentials.Conn) { relay.Relay( ctx, ctx.logger.Named("relay"), - ctx.telegramConn, - ctx.clientConn, + connIdleTimeout{Conn: ctx.telegramConn, timeout: p.idleTimeout}, + connIdleTimeout{Conn: ctx.clientConn, timeout: p.idleTimeout}, ) } From 87988326ab24a85237ea49cc3e8b0e9553d063b9 Mon Sep 17 00:00:00 2001 From: Alexey Dolotov Date: Sun, 29 Mar 2026 17:02:53 +0300 Subject: [PATCH 2/2] retry CI