[vlc-commits] httpd: simplify poll() handling, fix warning

Rémi Denis-Courmont git at videolan.org
Fri Jul 7 20:00:40 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Jul  7 21:00:24 2017 +0300| [263faf290c34a613b5a1e073167ac204bb1528fe] | committer: Rémi Denis-Courmont

httpd: simplify poll() handling, fix warning

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

 src/network/httpd.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/src/network/httpd.c b/src/network/httpd.c
index 233c01e89d..7e0cee164a 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -1955,21 +1955,14 @@ static void httpdLoop(httpd_host_t *host)
     vlc_restorecancel(canc);
 
     /* we will wait 20ms (not too big) if HTTPD_CLIENT_WAITING */
-    int ret = poll(ufd, nfd, b_low_delay ? 20 : -1);
+    while (poll(ufd, nfd, b_low_delay ? 20 : -1) < 0)
+    {
+        if (errno != EINTR)
+            msg_Err(host, "polling error: %s", vlc_strerror_c(errno));
+    }
 
     canc = vlc_savecancel();
     vlc_mutex_lock(&host->lock);
-    switch(ret) {
-        case -1:
-            if (errno != EINTR) {
-                /* Kernel on low memory or a bug: pace */
-                msg_Err(host, "polling error: %s", vlc_strerror_c(errno));
-                msleep(100000);
-            }
-        case 0:
-            vlc_restorecancel(canc);
-            return;
-    }
 
     /* Handle client sockets */
     now = mdate();



More information about the vlc-commits mailing list