[vlc-devel] Patch to reenable sap-timeout functionality (Bug 2007)
Dermot McGahon
dermot at lincor.com
Thu Mar 17 20:42:43 CET 2005
Index: sap.c
===================================================================
--- sap.c (revision 10060)
+++ sap.c (working copy)
@@ -508,11 +508,11 @@
static void Run( services_discovery_t *p_sd )
{
+ int i;
uint8_t *p_buffer;
- /* Dirty hack to slow down the startup of the sap interface */
- /* Unneeded now : our node is in no_select mode */
- // msleep( 500000 );
+ playlist_t *p_playlist;
+
/* read SAP packets */
while( !p_sd->b_die )
{
@@ -529,45 +529,37 @@
i_read = net_Select( p_sd, p_sd->p_sys->pi_fd, NULL,
p_sd->p_sys->i_fd, p_buffer,
MAX_SAP_BUFFER, 500000 );
-#if 0
+
+
/* Check for items that need deletion */
- for( i = 0 ; i< p_sd->p_sys->i_announces ; i++ )
+ for( i = 0 ; i < p_sd->p_sys->i_announces ; i++ )
{
- struct sap_announce_t *p_announce;
- mtime_t i_timeout = ( mtime_t ) 1000000*p_sys->i_timeout;
+ mtime_t i_timeout = ( mtime_t ) 1000000 *
p_sd->p_sys->i_timeout;
+
if( mdate() - p_sd->p_sys->pp_announces[i]->i_last > i_timeout
)
{
- msg_Dbg( p_sd,"Time out for %s, deleting (%i/%i)",
- p_sd->p_sys->pp_announces[i]->psz_name,
- i , p_sd->p_sys->i_announces );
+ struct sap_announce_t *p_announce;
+ p_announce = p_sd->p_sys->pp_announces[i];
- /* Remove the playlist item */
- p_playlist = vlc_object_find( p_sd, VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
- if( p_playlist )
- {
- int i_pos = playlist_GetPositionById( p_playlist,
- p_sd->p_sys->pp_announces[i]->i_id );
- playlist_Delete( p_playlist, i_pos );
- vlc_object_release( p_playlist );
- }
+ p_playlist = vlc_object_find( p_sd, VLC_OBJECT_PLAYLIST,
+ FIND_ANYWHERE );
+ if( p_playlist )
+ {
+ /* Remove the playlist item */
+ msg_Dbg( p_sd, "calling playlist_Delete");
+ playlist_Delete ( p_playlist,
p_announce->p_item->input.i_id );
+ }
- /* Free the p_announce */
- p_announce = p_sd->p_sys->pp_announces[i];
- if( p_announce->psz_name )
- free( p_announce->psz_name );
- if( p_announce->psz_uri )
- free( p_announce->psz_uri );
+ vlc_object_release( p_playlist);
- /* Remove the sap_announce from the array */
- REMOVE_ELEM( p_sd->p_sys->pp_announces,
- p_sd->p_sys->i_announces, i );
+ /* Free the p_announce */
- free( p_announce );
+ REMOVE_ELEM( p_sd->p_sys->pp_announces,
+ p_sd->p_sys->i_announces, i );
+ free( p_announce );
}
}
-#endif
/* Minimum length is > 6 */
if( i_read <= 6 )
@@ -884,6 +917,7 @@
vlc_object_release( p_playlist );
msg_Err( p_sd, "out of memory");
free( p_sap );
+ free( psz_value);
return NULL;
}
}
@@ -904,6 +938,7 @@
TAB_APPEND( p_sd->p_sys->i_announces,
p_sd->p_sys->pp_announces, p_sap );
+ free(psz_value);
return p_sap;
}
--
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html
More information about the vlc-devel
mailing list