]> git.sesse.net Git - vlc/commitdiff
sap: fix implicit timeout calculation
authorSantiago Gimeno <santiago.gimeno@gmail.com>
Mon, 17 Nov 2014 12:16:50 +0000 (13:16 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Tue, 18 Nov 2014 17:05:12 +0000 (18:05 +0100)
- RFC2974 states in Section 4:
      "If a session announcement message has not been received for ten times the
       announcement period, or one hour, whichever is the greater, then the
       session is deleted from the receiver's session cache."
  But the session was being deleted after three times the announcement period.

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/services_discovery/sap.c

index 5477924df247a1ecd17cf9a1f642ad00cba51970..88882151f2a5d2cbabcb846941ac3fbaedb33748 100644 (file)
@@ -582,9 +582,9 @@ static void *Run( void *data )
             mtime_t i_last_period = now - p_announce->i_last;
 
             /* Remove the announcement, if the last announcement was 1 hour ago
-             * or if the last packet emitted was 3 times the average time
+             * or if the last packet emitted was 10 times the average time
              * between two packets */
-            if( ( p_announce->i_period_trust > 5 && i_last_period > 3 * p_announce->i_period ) ||
+            if( ( p_announce->i_period_trust > 5 && i_last_period > 10 * p_announce->i_period ) ||
                 i_last_period > i_timeout )
             {
                 RemoveAnnounce( p_sd, p_announce );
@@ -593,7 +593,7 @@ static void *Run( void *data )
             {
                 /* Compute next timeout */
                 if( p_announce->i_period_trust > 5 )
-                    timeout = min_int((3 * p_announce->i_period - i_last_period) / 1000, timeout);
+                    timeout = min_int((10 * p_announce->i_period - i_last_period) / 1000, timeout);
                 timeout = min_int((i_timeout - i_last_period)/1000, timeout);
             }
         }