Changes
- Added
testServersflag inTelegramClientParamsfor connecting to Telegram's test environment with built-in DC seed addresses (DC1/DC2/DC3, port 443) - Built-in production and test DC IP tables (PROD_DC_IPV4/IPV6, TEST_DC_IPV4/IPV6), used as seeds and as fallback when
help.GetConfigis unavailable - Default starting DC for empty sessions is now DC2 (matches tdesktop), down from DC4
getDCnow follows production DC routing for both environments (help.GetConfigis the source of truth, with built-in seeds as fallback)- Centralised pts/qts/seq tracking and gap recovery in a new
UpdateManager - Switched channel-pts handling to wipe-on-diff strategy (
PtsWaiter, modelled after tdesktop) - Replaced linear msg_id dedup buffer with sorted
ReceivedIdsManager(binary-search insert, hard cap 400) - Activated exponential backoff (1→64s) on
getDifference/getChannelDifferencefailures - Added explicit handling for
UpdateChannelTooLong— triggers per-channel diff fetch
Fixes
- Fixed pending-update buffers, album timers and channel-pts state surviving across disconnects
- Fixed
Ping/PingDelayDisconnectbeing wrapped inInvokeWithLayerafterNewSessionCreated, which causedINPUT_METHOD_INVALIDcascades on DC migration - Fixed
disconnect()returning before the underlying TCP socket was actually closed, leading to overlapping reconnect cycles - Fixed
EventBuilder.resolvedflag persisting across reconnect, holding stale entity ids - Fixed re-entrancy when an event handler adds or removes handlers during dispatch