[vlc-devel] [PATCH 3/4] http: test: use interruptable accept()

Zhao Zhili quinkblack at foxmail.com
Wed Feb 3 17:04:25 UTC 2021


From: Zhao Zhili <zhilizhao at tencent.com>

---
 modules/access/http/tunnel_test.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/access/http/tunnel_test.c b/modules/access/http/tunnel_test.c
index 223085714e..b53734346b 100644
--- a/modules/access/http/tunnel_test.c
+++ b/modules/access/http/tunnel_test.c
@@ -34,10 +34,6 @@
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
-#ifndef SOCK_CLOEXEC
-# define SOCK_CLOEXEC 0
-# define accept4(a,b,c,d) accept(a,b,c)
-#endif
 #ifdef _WIN32
 # include <winsock2.h>
 #else
@@ -48,6 +44,7 @@
 #endif
 
 #include <vlc_common.h>
+#include <vlc_interrupt.h>
 #include <vlc_tls.h>
 #include "transport.h"
 
@@ -102,9 +99,12 @@ static void *proxy_thread(void *data)
 
     for (;;)
     {
-        int cfd = accept4(*lfd, NULL, NULL, SOCK_CLOEXEC);
+        int cfd = vlc_accept_i11e(*lfd, NULL, NULL, false);
         if (cfd == -1)
+        {
+            vlc_testcancel();
             continue;
+        }
 
         int canc = vlc_savecancel();
         proxy_client_process(cfd);
-- 
2.27.0



More information about the vlc-devel mailing list