mtproto icon indicating copy to clipboard operation
mtproto copied to clipboard

Reconnection doesn't work

Open innovative-sol opened this issue 3 years ago • 3 comments

Hi,

If you try calling client.Reconnect() after the connection is successful (let's say 30 seconds after connection) the app is unable to reconnect to the Telegram servers. It just hangs... (maybe some mutex or full channel)

Daniel

innovative-sol avatar Mar 09 '21 07:03 innovative-sol

@innovative-sol thanks for this notice, we'll try to find this bug

i think we need refactor a bit MTProto{} type, cuz everything is stacked in single struct. Maybe we need to split it at least on transport subpackage and messages, so we can find bugs like this one faster.

quenbyako avatar Mar 09 '21 11:03 quenbyako

Thanks for the package! With v1.0.0 there is no reconnect function, and the current master version throws a panic which is no longer caught by MTProto .RecoverFunc and I don't have any idea on how to catch it:

panic: reading message: reading message: required to reconnect!: read tcp 172.23.0.2:33290->149.154.167.50:443: i/o timeout

goroutine 35 [running]:
github.com/xelaj/mtproto.check(...)
 /src/vendor/github.com/xelaj/mtproto/utils.go:50
github.com/xelaj/mtproto.(*MTProto).startReadingResponses.func1(0x40003b0360, 0x7503d8, 0x400038c340)
 /src/vendor/github.com/xelaj/mtproto/mtproto.go:265 +0x1f8
created by github.com/xelaj/mtproto.(*MTProto).startReadingResponses
 /src/vendor/github.com/xelaj/mtproto/mtproto.go:246 +0x68

paskal avatar Jun 17 '21 20:06 paskal

Having the same problem. It fires with panic and breaks the process after a couple of minutes.

dmitrytrager avatar Jan 04 '22 13:01 dmitrytrager