]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Wed Sep 3 13:49:53 EDT 2008 Pekka Pessi <first.last@nokia.com>
authorMichael Jerris <mike@jerris.com>
Wed, 3 Sep 2008 18:27:56 +0000 (18:27 +0000)
committerMichael Jerris <mike@jerris.com>
Wed, 3 Sep 2008 18:27:56 +0000 (18:27 +0000)
  * outbound.c: do not use OPTIONS keepalive by default but on UDP

  On TCP, use TCP-level keepalives.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9418 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/sofia-sip/.update
libs/sofia-sip/libsofia-sip-ua/nua/outbound.c

index a33e098604dcd90ab74999cfa9e0d4e01b173401..55bf715ebbf842c1d5496aaf62118d1214756f8e 100644 (file)
@@ -1 +1 @@
-Wed Sep  3 14:27:05 EDT 2008
+Wed Sep  3 14:27:37 EDT 2008
index 84329455104e5eb2be25e4ec8e7ae8e9a7f8851d..3f4d8e294b25401e99584b62cc330d279cd0256d 100644 (file)
@@ -77,7 +77,7 @@ struct outbound {
     unsigned gruuize:1;                /**< Establish a GRUU */
     unsigned outbound:1;       /**< Try to use outbound */
     unsigned natify:1;         /**< Try to detect NAT */
-    unsigned okeepalive:1;     /**< Connection keepalive with OPTIONS */
+    signed okeepalive:2;       /**< Connection keepalive with OPTIONS */
     unsigned validate:1;       /**< Validate registration with OPTIONS */
     /* How to detect NAT binding or connect to outbound: */
     unsigned use_connect:1;    /**< Use HTTP connect */
@@ -270,7 +270,7 @@ int outbound_set_options(outbound_t *ob,
   prefs->gruuize = 1;
   prefs->outbound = 0;
   prefs->natify = 1;
-  prefs->okeepalive = 1;
+  prefs->okeepalive = -1;
   prefs->validate = 1;
   prefs->use_rport = 1;
 
@@ -662,12 +662,18 @@ void outbound_start_keepalive(outbound_t *ob,
                              nta_outgoing_t *register_transaction)
 {
   unsigned interval = 0;
-  int need_to_validate;
+  int need_to_validate, udp;
 
   if (!ob)
     return;
 
-  if (ob->ob_prefs.natify && ob->ob_prefs.okeepalive)
+  udp = ob->ob_via && ob->ob_via->v_protocol == sip_transport_udp;
+
+  if (ob->ob_prefs.natify &&
+      /* On UDP, use OPTIONS keepalive by default */
+      (udp ? ob->ob_prefs.okeepalive != 0
+       /* Otherwise, only if requested */
+       : ob->ob_prefs.okeepalive > 0))
     interval = ob->ob_prefs.interval;
   need_to_validate = ob->ob_prefs.validate && !ob->ob_validated;