[vlc-devel] commit: Remove HTTPD object type ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun Mar 30 16:14:39 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Sun Mar 30 16:35:31 2008 +0300| [0e1b522e9b6b5aae8aa288331d1e42c0271429a1]

Remove HTTPD object type

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

 include/vlc_objects.h      |    2 +-
 modules/misc/lua/objects.c |    1 -
 src/network/httpd.c        |   18 +++++++++++++++---
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/include/vlc_objects.h b/include/vlc_objects.h
index 196a41b..74e87bf 100644
--- a/include/vlc_objects.h
+++ b/include/vlc_objects.h
@@ -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)
diff --git a/modules/misc/lua/objects.c b/modules/misc/lua/objects.c
index 65f1b5e..9feff68 100644
--- a/modules/misc/lua/objects.c
+++ b/modules/misc/lua/objects.c
@@ -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" },
diff --git a/src/network/httpd.c b/src/network/httpd.c
index 79f96f2..d2d76fc 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -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 );
 }




More information about the vlc-devel mailing list