tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

Slow connection recovery on the change of the default route #2690

Closed azhuchkov closed 10 months ago

azhuchkov commented 11 months ago

In case of creating VPN tunnel message delivery may be delayed up to 2 min. The same after VPN shutting down. It would be helpful to have some control on watchdog timer that validates TCP session is still alive.

levlam commented 11 months ago

You must set "online" option to true whenever the user is online to have fast connection recovery whenever the user is online.

azhuchkov commented 11 months ago

Did you mean that I should set this status periodically? I tried to set it once before login. User status is shown as online, but message processing is still delayed for more than a minute.

levlam commented 11 months ago

If the user is online, then all delays are reduced to a bare minimum. If the user is offline, then resource usage is preferred.

Also, if you somehow know the exact time when default route changes, you can call setNetworkType right after this for immediate recovery.