Просмотр исходного кода

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
tags/v2.2.5^2^2
Alexey Dolotov 1 месяц назад
Родитель
Сommit
ec271baab0
1 измененных файлов: 2 добавлений и 2 удалений
  1. 2
    2
      mtglib/proxy.go

+ 2
- 2
mtglib/proxy.go Просмотреть файл

@@ -105,8 +105,8 @@ func (p *Proxy) ServeConn(conn essentials.Conn) {
105 105
 	relay.Relay(
106 106
 		ctx,
107 107
 		ctx.logger.Named("relay"),
108
-		ctx.telegramConn,
109
-		ctx.clientConn,
108
+		connIdleTimeout{Conn: ctx.telegramConn, timeout: p.idleTimeout},
109
+		connIdleTimeout{Conn: ctx.clientConn, timeout: p.idleTimeout},
110 110
 	)
111 111
 }
112 112
 

Загрузка…
Отмена
Сохранить