Record an MTProto-level error (transport 429; per TDLib, other codes don't tick this).
Earliest perf-now ms at which a new connection attempt is permitted.
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.
Reset all internal state. Mainly for tests.
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.
Optionalsignal: AbortSignal
Per-connection-slot flood control bundle modeled after TDLib's
ConnectionCreatorclient state (ConnectionCreator.cpp) — TDLib keys its flood control by pool slot (theSessionProxy#ihash), so each socket's connect history is throttled independently.Three limiters compose:
sanity— absolute ceiling, always appliedflood— burst limit on connection attempts, always appliedmtprotoError— ticks only on MTProto-level errors, always appliedTDLib 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).