httpd: correctly reads from ufd[]...
authorPaul Corke <paulc@datatote.co.uk>
Tue, 11 Nov 2008 10:05:45 +0000 (10:05 +0000)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Wed, 12 Nov 2008 16:10:56 +0000 (18:10 +0200)
...in the case where there are multiple clients, not all of which are
waiting to be serviced.

Signed-off-by: Rémi Denis-Courmont <rdenis@simphalempin.com>
src/network/httpd.c

index 546a77e..0e5406b 100644 (file)
@@ -2464,10 +2464,11 @@ retry:
         /* Handle client sockets */
         vlc_mutex_lock( &host->lock );
         now = mdate();
+        nfd = host->nfd;
         for( int i_client = 0; i_client < host->i_client; i_client++ )
         {
             httpd_client_t *cl = host->client[i_client];
-            const struct pollfd *pufd = &ufd[host->nfd + i_client];
+            const struct pollfd *pufd = &ufd[nfd];
 
             assert( pufd < &ufd[sizeof(ufd) / sizeof(ufd[0])] );
 
@@ -2501,6 +2502,8 @@ retry:
             {
                 cl->b_read_waiting = true;
             }
+
+            ++nfd;
         }
         vlc_mutex_unlock( &host->lock );