[vlc-commits] sap: fix implicit timeout calculation

Santiago Gimeno git at videolan.org
Tue Nov 18 18:07:55 CET 2014


vlc | branch: master | Santiago Gimeno <santiago.gimeno at gmail.com> | Mon Nov 17 13:16:50 2014 +0100| [125acdef1ed11c0684ccf57110d4f8741a4e705c] | committer: Jean-Baptiste Kempf

sap: fix implicit timeout calculation

- 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 at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=125acdef1ed11c0684ccf57110d4f8741a4e705c
---

 modules/services_discovery/sap.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c
index 5477924..8888215 100644
--- a/modules/services_discovery/sap.c
+++ b/modules/services_discovery/sap.c
@@ -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);
             }
         }



More information about the vlc-commits mailing list