[vlc-commits] tls: keep track of the underlying file descriptor

Rémi Denis-Courmont git at videolan.org
Tue May 12 21:39:20 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat May  9 18:00:50 2015 +0300| [8a0477a7f91f9fb0e36ebca8dce3c201f582a036] | committer: Rémi Denis-Courmont

tls: keep track of the underlying file descriptor

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

 include/vlc_tls.h |    1 +
 src/network/tls.c |   11 +++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/include/vlc_tls.h b/include/vlc_tls.h
index 8b55ee8..9386d9a 100644
--- a/include/vlc_tls.h
+++ b/include/vlc_tls.h
@@ -38,6 +38,7 @@ struct vlc_tls
     VLC_COMMON_MEMBERS
 
     void *sys;
+    int fd;
 
     struct virtual_socket_t sock;
 };
diff --git a/src/network/tls.c b/src/network/tls.c
index c9c99c7..b740bf8 100644
--- a/src/network/tls.c
+++ b/src/network/tls.c
@@ -151,10 +151,13 @@ vlc_tls_t *vlc_tls_SessionCreate (vlc_tls_creds_t *crd, int fd,
     vlc_tls_t *session = vlc_custom_create (crd, sizeof (*session),
                                             "tls session");
     int val = crd->open (crd, session, fd, host, alpn);
-    if (val == VLC_SUCCESS)
-        return session;
-    vlc_object_release (session);
-    return NULL;
+    if (val != VLC_SUCCESS)
+    {
+        vlc_object_release (session);
+        return NULL;
+    }
+    session->fd = fd;
+    return session;
 }
 
 int vlc_tls_SessionHandshake (vlc_tls_t *session, const char *host,



More information about the vlc-commits mailing list