Skip to main content

Module util

Module util 

Source

Constants§

COMPRESSION_THRESHOLD
Minimum body size above which we attempt zlib compression.

Functions§

build_container_body
Build the body of a msg_container#73f1f8dc from a list of (msg_id, seqno, body) inner messages.
build_msgs_ack_body
Build the TL body for msgs_ack#62d6b459 msg_ids:Vector<long>.
crc32_ieee
CRC-32 using the standard IEEE 802.3 polynomial (for Full transport framing).
gz_inflate
gz_pack_body
Wrap data in a gzip_packed#3072cfa1 packed_data:bytes TL frame.
jitter_delay
Apply ±20 % random jitter to a backoff delay. Prevents thundering-herd when many clients reconnect simultaneously (e.g. after a server restart or a shared network outage).
maybe_gz_decompress
maybe_gz_pack
Optionally compress data. Returns the compressed gzip_packed wrapper if it is shorter than the original; otherwise returns data unchanged.
random_i64
tl_read_bytes
tl_read_string
tl_write_bytes
TL bytes wire encoding (used inside gzip_packed).