[vlc-commits] network: fix fallback w/o TCP Fast Open

Rémi Denis-Courmont git at videolan.org
Sat Mar 4 18:56:01 CET 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Mar  4 19:49:34 2017 +0200| [20150f3d3660454e56ff9a1b3a6917f88fc2b9fd] | committer: Rémi Denis-Courmont

network: fix fallback w/o TCP Fast Open

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

 src/network/tls.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/network/tls.c b/src/network/tls.c
index 3dcf2f9..29ea85b 100644
--- a/src/network/tls.c
+++ b/src/network/tls.c
@@ -509,25 +509,31 @@ static ssize_t vlc_tls_ConnectWrite(vlc_tls_t *tls,
     };
     ssize_t ret;
 
+    /* Next time, write directly. Do not retry to connect. */
+    tls->writev = vlc_tls_SocketWrite;
+
     ret = sendmsg(vlc_tls_SocketGetFD(tls), &msg, MSG_NOSIGNAL|MSG_FASTOPEN);
     if (ret >= 0)
     {   /* Fast open in progress */
-        tls->writev = vlc_tls_SocketWrite;
         return ret;
     }
 
     if (errno == EINPROGRESS)
-        return vlc_tls_WaitConnect(tls);
+    {
+        if (vlc_tls_WaitConnect(tls))
+            return -1;
+    }
+    else
     if (errno != EOPNOTSUPP)
         return -1;
     /* Fast open not supported or disabled... fallback to normal mode */
+#else
+    tls->writev = vlc_tls_SocketWrite;
 #endif
 
     if (vlc_tls_Connect(tls))
         return -1;
 
-    /* Next time, write directly. Do not retry to connect. */
-    tls->writev = vlc_tls_SocketWrite;
     return vlc_tls_SocketWrite(tls, iov, count);
 }
 



More information about the vlc-commits mailing list