Commit 14362bdd authored by Fabrice Bellet's avatar Fabrice Bellet

stun timer: move back to 5 retransmissions

With the pacing behaviour of the ICE RFC 5245, the stun packets are
send with an initial timeout that cannot be lower that 100ms, and that
increases of 20ms for each new in-progress/waiting conncheck above 5.
Typical initial timeout is in the range 100ms - 400ms (obtained when
there are 20 in-progress/waiting connchecks).

The rationale with this modification is that we consider that 4
retransmissions with an initial timeout of 100ms and a last timeout of 4
* 100 ms, gives (1 + 2 + 4 + 8 + 4) * 100ms = 1900ms for a response to
be received after the initial stun request has been sent, which is
probably enough in most situations. With an initial timeout of 400ms,
this delay extends to 7600ms (this is proportional to the value of the
initial timeout).

Differential Revision: https://phabricator.freedesktop.org/D1109
parent 4f5b991e
......@@ -438,7 +438,7 @@ static void keepalive (void)
static void test (void (*func) (void), const char *name)
{
alarm (30);
alarm (20);
printf ("%s test... ", name);
func ();
......
......@@ -132,7 +132,13 @@ struct stun_timer_s {
* The default intial timeout to use for the timer
* RFC recommendds 500, but it's ridiculous, 50ms is known to work in most
* cases as it is also what is used by SIP style VoIP when sending A-Law and
* mu-Law audio, so 200ms should be hyper safe.
* mu-Law audio, so 200ms should be hyper safe. With an initial timeout
* of 200ms, a default of 5 transmissions, the last timeout will be
* 4 * 200ms, and we expect to receive a response from the stun server
* before (1 + 2 + 4 + 8 + 4) * 200ms = 3800 ms after the initial
* stun request t1 has been sent:
*
* t1 ..200ms.. t2 ..400ms.. t3 ..800ms.. t4 ..1600ms.. t5 ..800ms.. X
*/
#define STUN_TIMER_DEFAULT_TIMEOUT 200
......@@ -141,7 +147,7 @@ struct stun_timer_s {
*
* The default maximum retransmissions allowed before a timer decides to timeout
*/
#define STUN_TIMER_DEFAULT_MAX_RETRANSMISSIONS 7
#define STUN_TIMER_DEFAULT_MAX_RETRANSMISSIONS 5
/**
* STUN_TIMER_DEFAULT_RELIABLE_TIMEOUT:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment