dmitry          Mon Feb 26 09:39:08 2007 UTC

  Modified files:              
    /php-src/sapi/cgi   fastcgi.c 
  Log:
  poll() is not affected by FD_SETSIZE (Tony)
  
  
http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/fastcgi.c?r1=1.33&r2=1.34&diff_format=u
Index: php-src/sapi/cgi/fastcgi.c
diff -u php-src/sapi/cgi/fastcgi.c:1.33 php-src/sapi/cgi/fastcgi.c:1.34
--- php-src/sapi/cgi/fastcgi.c:1.33     Sat Feb 24 11:21:10 2007
+++ php-src/sapi/cgi/fastcgi.c  Mon Feb 26 09:39:08 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: fastcgi.c,v 1.33 2007/02/24 11:21:10 dmitry Exp $ */
+/* $Id: fastcgi.c,v 1.34 2007/02/26 09:39:08 dmitry Exp $ */
 
 #include "php.h"
 #include "fastcgi.h"
@@ -764,22 +764,23 @@
                                break;
 #else
                                if (req->fd >= 0) {
-                                       if (req->fd < FD_SETSIZE) {
 #if defined(HAVE_SYS_POLL_H) && defined(HAVE_POLL)
-                                               struct pollfd fds;
-                                               int ret;
+                                       struct pollfd fds;
+                                       int ret;
 
-                                               fds.fd = req->fd;
-                                               fds.events = POLLIN;
-                                               fds.revents = 0;
-                                               do {
-                                                       errno = 0;
-                                                       ret = poll(&fds, 1, 
5000);
-                                               } while (ret < 0 && errno == 
EINTR);
-                                               if (ret > 0 && (fds.revents & 
POLLIN)) {
-                                                       break;
-                                               }
+                                       fds.fd = req->fd;
+                                       fds.events = POLLIN;
+                                       fds.revents = 0;
+                                       do {
+                                               errno = 0;
+                                               ret = poll(&fds, 1, 5000);
+                                       } while (ret < 0 && errno == EINTR);
+                                       if (ret > 0 && (fds.revents & POLLIN)) {
+                                               break;
+                                       }
+                                       fcgi_close(req, 1, 0);
 #else
+                                       if (req->fd < FD_SETSIZE) {
                                                struct timeval tv = {5,0};
                                                fd_set set;
                                                int ret;
@@ -793,12 +794,12 @@
                                                if (ret > 0 && 
FD_ISSET(req->fd, &set)) {
                                                        break;
                                                }
-#endif
                                                fcgi_close(req, 1, 0);
                                        } else {
                                                fprintf(stderr, "Too many open 
file descriptors. FD_SETSIZE limit exceeded.");
                                                fcgi_close(req, 1, 0);
                                        }
+#endif
                                }
 #endif
                        }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to