[vlc-commits] sap: fix implicit timeout calculation

Santiago Gimeno git at videolan.org
Thu Nov 20 19:45:18 CET 2014


vlc/vlc-2.2 | branch: master | Santiago Gimeno <santiago.gimeno at gmail.com> | Mon Nov 17 13:16:50 2014 +0100| [704cf0192e8fa08dcaffabc3057d4df9f5c1ad60] | 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>
(cherry picked from commit 125acdef1ed11c0684ccf57110d4f8741a4e705c)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=704cf0192e8fa08dcaffabc3057d4df9f5c1ad60
---

 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 430d234..a044d4e 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