Documentation - v0.30.1
    Preparing search index...

    Class ConnectionFloodController

    Per-connection-slot flood control bundle modeled after TDLib's ConnectionCreator client state (ConnectionCreator.cpp) — TDLib keys its flood control by pool slot (the SessionProxy#i hash), so each socket's connect history is throttled independently.

    Three limiters compose:

    • sanity — absolute ceiling, always applied
    • flood — burst limit on connection attempts, always applied
    • mtprotoError — ticks only on MTProto-level errors, always applied

    TDLib additionally has a stricter "online" regime keyed to app foreground state — we have no such signal, so only the permissive regime is modeled.

    wait() blocks until all limiters allow a fresh connection and records the event atomically (sanity + flood).

    Index

    Constructors

    Properties

    mtprotoError: FloodControl
    sanity: FloodControl

    Methods

    • Notify a network-up transition.

      TDLib clears sanity + online-regime flood + backoff on ConnectionCreator::on_network(true). We don't model the online regime, and our transport layer owns its own reconnect backoff, so only the sanity limiter is reset here.

      Returns void

    • Block until a connection attempt is permitted under all applicable limiters, then record the attempt. Concurrent waiters serialize fairly because the first to wake records its event before the next checks state.

      If signal aborts, the pending timer is cleared and the promise rejects with the signal's reason.

      Parameters

      • Optionalsignal: AbortSignal

      Returns Promise<void>