Skip to content

v0.167.0

Latest

Choose a tag to compare

@ernado ernado released this 02 Dec 19:59
744a973

Faster file transfers: Client.FileDC downloads through media-only DC addresses (about 10 times faster), and the uploader keeps 8 MiB of parts in flight. Layer 234.

Features

Downloads through media-only DC addresses (#2010)

  • Telegram limits upload.getFile through the regular addresses of a DC to about 5 MiB/s per account, Premium included, with FLOOD_WAIT on top; through the media-only addresses (dc_options with media_only) it doesn't. Telegram Desktop, Android and tdlib download files there.
  • Client.FileDC now connects to the media-only addresses where the config of the client lists them for the DC, and falls back to the regular ones otherwise. Options.FileDCRegularOnly restores the old behaviour.
  • Measured on production, Premium account, 1211 MiB on DC 2, 1 MiB parts: 5.3 MiB/s with 253 flood waits before; 39.8 MiB/s with the default pool of 4 connections and 52.6 MiB/s with 16, without flood waits.
  • The list of media-only addresses depends on the account and not every DC has them: Client.MediaOnly to a DC without them now fails at once with ErrNoMediaOnly.

Uploads send 8 MiB of parts at a time (#2008, #2009)

  • Parts of small files are sent in parallel too, big files and streams use 512 KiB parts, and by default as many parts are in flight as fit into 8 MiB (WithThreads still sets it), like Telegram for Android.
  • On a slow link the connection counts the bytes of unanswered requests and allows them time, like Telegram Desktop: the pong limit grows and resends wait for the backlog (rpc.Options.Backlog), so a big upload is no longer cut by a missed pong or flooded with resent parts.

Timings of pushed updates (#1986)

  • gotd.client.updates.server.delay, receive.delay, process.duration and handle.duration histograms and an Update timing debug record; mtproto.MessageInfoHandler for the msg_id, receive time and server time offset of a message. See docs/update-latency.md.

cmd/idlebench (#2002) measures the cost of idle clients against a tgtest cluster.

Layer 234 (#1990).

Fixes

  • A connection that keeps receiving data is no longer closed on a late pong (#2003).
  • Key exchange steps 5 and 7 honour ExchangeTimeout; a peer that stopped answering there parked the client forever (#1838, by @pylakey).
  • bad_server_salt for a ping no longer logs "rpc callback not set" at Warn level about hourly on every connection (#2010).
  • CancellableGroup.Wait releases its context; repeated reconnect failures leaked contexts (#1859, by @true-seeker).
  • Dialogs iterator: the offset peer comes from the last dialog with a peer, so a page ending on a dialogCommunity no longer stops it (#1981, by @bardrop), and the total counts dialogs, not messages (#2000).
  • Client.DC and Client.MediaOnly pass the test DC flag to their connections (#1988, by @anri217).
  • uploader.FromReader uses the remaining size of in-memory readers (#1992, by @AmanBoronbaev).
  • 64-bit atomics are aligned on 32-bit platforms (#1985 by @fatshotty, #1997).
  • CheckDH remembers primes that passed, saving about 250 ms of CPU per key exchange (#1989, by @Cigarrr).

Full Changelog: v0.166.1...v0.167.0