Expand description
The retransmission timer of RFC 8489 section 6.2, shared by every transaction layer. The retransmission timer of RFC 8489 section 6.2, as data and arithmetic without I/O.
Client runs on it, and so does every other transaction layer
that sends STUN requests to a server (the TURN client), so that there is one schedule:
- over UDP a request is sent at 0, RTO, 3 RTO, 7 RTO and so on (the interval doubles), Rc times in all, and its transaction fails Rm x RTO after the last one (section 6.2.1);
- over a reliable transport it is sent once and fails Ti after it started (section 6.2.2);
- the RTO starts at a configured value and then follows the server’s round-trip times as
RFC 6298 computes it, kept per server and dropped after ten minutes without a
transaction (
RtoEstimator).
Structs§
- RtoEstimator
- The retransmission timeout of RFC 6298, as RFC 8489 section 6.2.1 uses it: kept per server, to 1 ms, never below the configured initial value, and forgotten after ten minutes without a transaction.
- Schedule
- The parameters of the retransmission schedule (RFC 8489 sections 6.2.1 and 6.2.2). The default is the RFC’s: Rc 7, Rm 16, Ti 39.5 s.
Constants§
- DEFAULT_
MAX_ OUTSTANDING - RFC 8489 section 6.2: outstanding transactions to one server.
- DEFAULT_
RC - RFC 8489 section 6.2.1: Rc, the number of times a request is sent.
- DEFAULT_
RM - RFC 8489 section 6.2.1: Rm, the last wait in units of RTO.
- DEFAULT_
RTO - RFC 8489 section 6.2.1: the initial RTO “SHOULD be greater than or equal to 500 ms”.
- DEFAULT_
SERVER_ ERROR_ RESENDS - RFC 8489 section 6.3.4: after an error response of 500 through 599 “the client MAY resend the request; clients that do so MUST limit the number of times they do this. Unless a specific error code specifies a different value, the number of retransmissions SHOULD be limited to 4.” The engine’s clients resend that many times by default.
- DEFAULT_
TI - RFC 8489 section 6.2.2: Ti, how long a request over a reliable transport waits.
- RTO_
CACHE_ LIFETIME - RFC 8489 section 6.2.1: a cached RTO is stale after ten minutes without a transaction.
Functions§
- after
now + d, without the panicInstantreserves for an overflow.- is_
server_ error - Whether
codeis one of the server errors (500 through 599) after which RFC 8489 section 6.3.4 lets a client resend its request. - server_
error_ resend_ delay - How long a client waits, after the server-error response, before the
resend-th resend of a request (1 for the first): the interval its retransmission of the same number would wait (RFC 8489 section 6.2.1: RTO, then twice that, and so on), so that four resends are spread over RTO, 2 RTO, 4 RTO and 8 RTO (7.5 s at 500 ms) and a failing server is not asked again at the rate it answers. Each resend is a new transaction, under a new transaction id, with the retransmission timer of its own.