Commit 0e1b522e authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove HTTPD object type

parent ae8e44ae
......@@ -47,7 +47,7 @@
#define VLC_OBJECT_VOUT (-9)
#define VLC_OBJECT_AOUT (-10)
#define VLC_OBJECT_SOUT (-11)
#define VLC_OBJECT_HTTPD (-12)
#define VLC_OBJECT_PACKETIZER (-13)
#define VLC_OBJECT_ENCODER (-14)
#define VLC_OBJECT_DIALOGS (-15)
......
......@@ -117,7 +117,6 @@ static int vlc_object_type_from_string( const char *psz_name )
{ VLC_OBJECT_VOUT, "vout" },
{ VLC_OBJECT_AOUT, "aout" },
{ VLC_OBJECT_SOUT, "sout" },
{ VLC_OBJECT_HTTPD, "httpd" },
{ VLC_OBJECT_PACKETIZER, "packetizer" },
{ VLC_OBJECT_ENCODER, "encoder" },
{ VLC_OBJECT_DIALOGS, "dialogs" },
......
......@@ -981,7 +981,7 @@ httpd_host_t *httpd_TLSHostNew( vlc_object_t *p_this, const char *psz_hostname,
httpd_host_t *host;
tls_server_t *p_tls;
char *psz_host;
vlc_value_t lockval;
vlc_value_t lockval, ptrval;
int i;
if( psz_hostname == NULL )
......@@ -996,14 +996,18 @@ httpd_host_t *httpd_TLSHostNew( vlc_object_t *p_this, const char *psz_hostname,
/* to be sure to avoid multiple creation */
var_Create( p_this->p_libvlc, "httpd_mutex", VLC_VAR_MUTEX );
var_Create( p_this->p_libvlc, "httpd_object", VLC_VAR_ADDRESS );
var_Get( p_this->p_libvlc, "httpd_mutex", &lockval );
vlc_mutex_lock( lockval.p_address );
var_Get( p_this->p_libvlc, "httpd_object", &ptrval );
if( !(httpd = vlc_object_find( p_this, VLC_OBJECT_HTTPD, FIND_ANYWHERE )) )
if( ptrval.p_address != NULL )
httpd = ptrval.p_address;
else
{
msg_Info( p_this, "creating httpd" );
httpd = (httpd_t *)vlc_custom_create( p_this, sizeof (*httpd),
VLC_OBJECT_HTTPD,
VLC_OBJECT_GENERIC,
psz_object_type );
if( httpd == NULL )
{
......@@ -1015,6 +1019,8 @@ httpd_host_t *httpd_TLSHostNew( vlc_object_t *p_this, const char *psz_hostname,
httpd->i_host = 0;
httpd->host = NULL;
ptrval.p_address = httpd;
var_Set( p_this->p_libvlc, "httpd_object", ptrval );
vlc_object_yield( httpd );
vlc_object_attach( httpd, p_this->p_libvlc );
}
......@@ -1191,9 +1197,15 @@ void httpd_HostDelete( httpd_host_t *host )
vlc_object_release( httpd );
if( httpd->i_host <= 0 )
{
vlc_value_t ptrval;
msg_Dbg( httpd, "no host left, stopping httpd" );
ptrval.p_address = NULL;
var_Set( httpd->p_libvlc, "httpd_object", ptrval );
vlc_object_detach( httpd );
vlc_object_release( httpd );
}
vlc_mutex_unlock( lockval.p_address );
}
......
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