dmitry          Thu May 10 15:22:15 2007 UTC

  Modified files:              
    /php-src/sapi/cgi   fastcgi.c 
  Log:
  Fixed bug #41291 (FastCGI does not set SO_REUSEADDR). (fmajid at kefta dot 
com)
  
  
http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/fastcgi.c?r1=1.37&r2=1.38&diff_format=u
Index: php-src/sapi/cgi/fastcgi.c
diff -u php-src/sapi/cgi/fastcgi.c:1.37 php-src/sapi/cgi/fastcgi.c:1.38
--- php-src/sapi/cgi/fastcgi.c:1.37     Mon Apr  9 15:40:23 2007
+++ php-src/sapi/cgi/fastcgi.c  Thu May 10 15:22:15 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: fastcgi.c,v 1.37 2007/04/09 15:40:23 dmitry Exp $ */
+/* $Id: fastcgi.c,v 1.38 2007/05/10 15:22:15 dmitry Exp $ */
 
 #include "php.h"
 #include "fastcgi.h"
@@ -345,6 +345,13 @@
        int       listen_socket;
        sa_t      sa;
        socklen_t sock_len;
+#ifdef SO_REUSEADDR
+# ifdef _WIN32
+       BOOL reuse = 1;
+# else
+       int reuse = 1;
+# endif
+#endif
 
        if ((s = strchr(path, ':'))) {
                port = atoi(s+1);
@@ -434,6 +441,9 @@
 
        /* Create, bind socket and start listen on it */
        if ((listen_socket = socket(sa.sa.sa_family, SOCK_STREAM, 0)) < 0 ||
+#ifdef SO_REUSEADDR
+           setsockopt(listen_socket, SOL_SOCKET, SO_REUSEADDR, (char*)&reuse, 
sizeof(reuse)) < 0 ||
+#endif
            bind(listen_socket, (struct sockaddr *) &sa, sock_len) < 0 ||
            listen(listen_socket, backlog) < 0) {
 

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

Reply via email to