Commit 704cf019 authored by Santiago Gimeno's avatar Santiago Gimeno Committed by 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: default avatarJean-Baptiste Kempf <jb@videolan.org>
(cherry picked from commit 125acdef1ed11c0684ccf57110d4f8741a4e705c)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 0c3fa2b0
...@@ -582,9 +582,9 @@ static void *Run( void *data ) ...@@ -582,9 +582,9 @@ static void *Run( void *data )
mtime_t i_last_period = now - p_announce->i_last; mtime_t i_last_period = now - p_announce->i_last;
/* Remove the announcement, if the last announcement was 1 hour ago /* 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 */ * 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 ) i_last_period > i_timeout )
{ {
RemoveAnnounce( p_sd, p_announce ); RemoveAnnounce( p_sd, p_announce );
...@@ -593,7 +593,7 @@ static void *Run( void *data ) ...@@ -593,7 +593,7 @@ static void *Run( void *data )
{ {
/* Compute next timeout */ /* Compute next timeout */
if( p_announce->i_period_trust > 5 ) 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); timeout = min_int((i_timeout - i_last_period)/1000, timeout);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment