mirror of
https://github.com/php/php-src.git
synced 2025-01-11 05:24:49 +08:00
Fixed bug #41291 (FastCGI does not set SO_REUSEADDR). (fmajid at kefta dot com)
This commit is contained in:
parent
f0778af384
commit
d009d41cb2
@ -345,6 +345,13 @@ int fcgi_listen(const char *path, int backlog)
|
||||
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 @@ int fcgi_listen(const char *path, int backlog)
|
||||
|
||||
/* 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) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user