]> git.sesse.net Git - vlc/blobdiff - src/network/tls.c
Merge branch 'master' of git://git.videolan.org/vlc
[vlc] / src / network / tls.c
index 11e3dd2a24861ce817b2de1bd85aed9ba9252aa8..9c2590d943420d8d1dcc4fa654fce8fd75ff9564 100644 (file)
@@ -34,6 +34,7 @@
 #include "libvlc.h"
 
 #include <vlc_tls.h>
+#include <vlc_modules.h>
 
 /**
  * Allocates a whole server's TLS credentials.
@@ -69,7 +70,8 @@ tls_ServerCreate (vlc_object_t *obj, const char *cert_path,
         var_SetString (srv, "tls-x509-key", key_path);
     }
 
-    srv->p_module = module_Need (srv, "tls server", 0, 0);
+    vlc_object_attach (srv, obj);
+    srv->p_module = module_need (srv, "tls server", NULL, false );
     if (srv->p_module == NULL)
     {
         msg_Err (srv, "TLS server plugin not available");
@@ -77,7 +79,6 @@ tls_ServerCreate (vlc_object_t *obj, const char *cert_path,
         return NULL;
     }
 
-    vlc_object_attach (srv, obj);
     msg_Dbg (srv, "TLS server plugin initialized");
     return srv;
 }
@@ -92,8 +93,7 @@ void tls_ServerDelete (tls_server_t *srv)
     if (srv == NULL)
         return;
 
-    module_Unneed (srv, srv->p_module);
-    vlc_object_detach (srv);
+    module_unneed (srv, srv->p_module);
     vlc_object_release (srv);
 }
 
@@ -185,7 +185,8 @@ tls_ClientCreate (vlc_object_t *obj, int fd, const char *psz_hostname)
     else
         msg_Dbg (cl, "requested anonymous server");
 
-    cl->p_module = module_Need (cl, "tls client", 0, 0);
+    vlc_object_attach (cl, obj);
+    cl->p_module = module_need (cl, "tls client", NULL, false );
     if (cl->p_module == NULL)
     {
         msg_Err (cl, "TLS client plugin not available");
@@ -202,12 +203,11 @@ tls_ClientCreate (vlc_object_t *obj, int fd, const char *psz_hostname)
     if (val == 0)
     {
         msg_Dbg (cl, "TLS client session initialized");
-        vlc_object_attach (cl, obj);
         return cl;
     }
     msg_Err (cl, "TLS client session handshake error");
 
-    module_Unneed (cl, cl->p_module);
+    module_unneed (cl, cl->p_module);
     vlc_object_release (cl);
     return NULL;
 }
@@ -222,7 +222,6 @@ void tls_ClientDelete (tls_session_t *cl)
     if (cl == NULL)
         return;
 
-    module_Unneed (cl, cl->p_module);
-    vlc_object_detach (cl);
+    module_unneed (cl, cl->p_module);
     vlc_object_release (cl);
 }