stun timer: Do 7 retransmissions as recommended
authorOlivier Crête <olivier.crete@collabora.com>
Fri, 19 Feb 2016 20:01:03 +0000 (15:01 -0500)
committerOlivier Crête <olivier.crete@collabora.com>
Mon, 6 Jun 2016 21:06:55 +0000 (17:06 -0400)
Also reduce the normal timeout to make the test bearable.

This is what RFC 5389 section 7.2.1

Differential Revision: https://phabricator.freedesktop.org/D1056
Maniphest Task: https://phabricator.freedesktop.org/T3339

stun/tests/test-bind.c
stun/usages/timer.h

index 0c7646f..2cf4feb 100644 (file)
@@ -438,7 +438,7 @@ static void keepalive (void)
 
 static void test (void (*func) (void), const char *name)
 {
-  alarm (20);
+  alarm (30);
 
   printf ("%s test... ", name);
   func ();
index e6501cb..e74353b 100644 (file)
@@ -130,15 +130,18 @@ struct stun_timer_s {
  * STUN_TIMER_DEFAULT_TIMEOUT:
  *
  * 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.
  */
-#define STUN_TIMER_DEFAULT_TIMEOUT 600
+#define STUN_TIMER_DEFAULT_TIMEOUT 200
 
 /**
  * STUN_TIMER_DEFAULT_MAX_RETRANSMISSIONS:
  *
  * The default maximum retransmissions allowed before a timer decides to timeout
  */
-#define STUN_TIMER_DEFAULT_MAX_RETRANSMISSIONS 3
+#define STUN_TIMER_DEFAULT_MAX_RETRANSMISSIONS 7
 
 /**
  * STUN_TIMER_DEFAULT_RELIABLE_TIMEOUT: