[vlc-commits] network: use vlc_tls_GetPolLFD()
Rémi Denis-Courmont
git at videolan.org
Sun Nov 18 16:57:09 CET 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Nov 17 21:48:28 2018 +0200| [80b494b30f6732e5460b9d472a186d3fb0929d61] | committer: Rémi Denis-Courmont
network: use vlc_tls_GetPolLFD()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=80b494b30f6732e5460b9d472a186d3fb0929d61
---
src/network/stream.c | 4 ++--
src/network/tls.c | 9 +++++----
test/modules/misc/tls.c | 7 ++++---
3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/network/stream.c b/src/network/stream.c
index 33d27d06aa..6e015d5c4e 100644
--- a/src/network/stream.c
+++ b/src/network/stream.c
@@ -56,8 +56,8 @@ ssize_t vlc_tls_Read(vlc_tls_t *session, void *buf, size_t len, bool waitall)
struct pollfd ufd;
struct iovec iov;
- ufd.fd = vlc_tls_GetFD(session);
ufd.events = POLLIN;
+ ufd.fd = vlc_tls_GetPollFD(session, &ufd.events);
iov.iov_base = buf;
iov.iov_len = len;
@@ -97,8 +97,8 @@ ssize_t vlc_tls_Write(vlc_tls_t *session, const void *buf, size_t len)
struct pollfd ufd;
struct iovec iov;
- ufd.fd = vlc_tls_GetFD(session);
ufd.events = POLLOUT;
+ ufd.fd = vlc_tls_GetPollFD(session, &ufd.events);
iov.iov_base = (void *)buf;
iov.iov_len = len;
diff --git a/src/network/tls.c b/src/network/tls.c
index 00193eeec8..7767932b4d 100644
--- a/src/network/tls.c
+++ b/src/network/tls.c
@@ -170,12 +170,11 @@ vlc_tls_t *vlc_tls_ClientSessionCreate(vlc_tls_creds_t *crd, vlc_tls_t *sock,
vlc_tick_t deadline = vlc_tick_now ();
deadline += VLC_TICK_FROM_MS( var_InheritInteger (crd, "ipv4-timeout") );
- struct pollfd ufd[1];
- ufd[0].fd = vlc_tls_GetFD(sock);
-
vlc_cleanup_push (cleanup_tls, session);
while ((val = crd->handshake(crd, session, host, service, alp)) != 0)
{
+ struct pollfd ufd[1];
+
if (val < 0 || vlc_killed() )
{
if (val < 0)
@@ -191,7 +190,9 @@ error:
now = deadline;
assert (val <= 2);
- ufd[0] .events = (val == 1) ? POLLIN : POLLOUT;
+
+ ufd[0].events = (val == 1) ? POLLIN : POLLOUT;
+ ufd[0].fd = vlc_tls_GetPollFD(sock, &ufd->events);
vlc_restorecancel(canc);
val = vlc_poll_i11e(ufd, 1, MS_FROM_VLC_TICK(deadline - now));
diff --git a/test/modules/misc/tls.c b/test/modules/misc/tls.c
index 4259151ad8..9ade43560b 100644
--- a/test/modules/misc/tls.c
+++ b/test/modules/misc/tls.c
@@ -47,20 +47,21 @@ static vlc_tls_creds_t *client_creds;
static void *tls_echo(void *data)
{
vlc_tls_t *tls = data;
- struct pollfd ufd;
ssize_t val;
char buf[256];
- ufd.fd = vlc_tls_GetFD(tls);
-
while ((val = vlc_tls_SessionHandshake(server_creds, tls)) > 0)
{
+ struct pollfd ufd;
+
switch (val)
{
case 1: ufd.events = POLLIN; break;
case 2: ufd.events = POLLOUT; break;
default: vlc_assert_unreachable();
}
+
+ ufd.fd = vlc_tls_GetPollFD(tls, &ufd.events);
poll(&ufd, 1, -1);
}
More information about the vlc-commits
mailing list