From ae543227757abf188d1a9c640560489a252979c5 Mon Sep 17 00:00:00 2001
From: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
Date: Tue, 26 Apr 2016 16:49:59 -0400
Subject: [PATCH] ice: increase stun RTO

This patch increases STUN RTO to 500ms.
This gives a better total time to check all ICE connections
(during negotiation). The previous RTO let less than 8s, too short
for ICE messages exchange over DHT.

Change-Id: I8088abdc4d2306931adb3fdc19edda290479ab6f
Tuleap: #614
---
 src/ice_transport.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/ice_transport.cpp b/src/ice_transport.cpp
index 601714d359..3f009185af 100644
--- a/src/ice_transport.cpp
+++ b/src/ice_transport.cpp
@@ -875,6 +875,12 @@ IceTransportFactory::IceTransportFactory()
     pj_ice_strans_cfg_default(&ice_cfg_);
     ice_cfg_.stun_cfg.pf = &cp_.factory;
 
+    // v2.4.5 of PJNATH has a default of 100ms but RFC 5389 since version 14 requires
+    // a minimum of 500ms on fixed-line links. Our usual case is wireless links.
+    // This solves too long ICE exchange by DHT.
+    // Using 500ms with default PJ_STUN_MAX_TRANSMIT_COUNT (7) gives around 31s before timeout.
+    ice_cfg_.stun_cfg.rto_msec = 500;
+
     ice_cfg_.af = pj_AF_INET();
 
     ice_cfg_.stun.cfg.max_pkt_size = 8192;
-- 
GitLab