REUSE the socket on spawning

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@606 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.2
Jan Kneschke 17 years ago
parent 34e169d58d
commit 8b88536b71
  1. 10
      src/spawn-fcgi.c

@ -92,6 +92,7 @@ int fcgi_spawn_connection(char *appPath, unsigned short port, const char *unixso
if (-1 == connect(fcgi_fd, fcgi_addr, servlen)) {
/* server is not up, spawn in */
pid_t child;
int val;
if (unixsocket) unlink(unixsocket);
@ -103,7 +104,14 @@ int fcgi_spawn_connection(char *appPath, unsigned short port, const char *unixso
__FILE__, __LINE__);
return -1;
}
val = 1;
if (setsockopt(fcgi_fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)) < 0) {
fprintf(stderr, "%s.%d\n",
__FILE__, __LINE__);
return -1;
}
/* create socket */
if (-1 == bind(fcgi_fd, fcgi_addr, servlen)) {
fprintf(stderr, "%s.%d: bind failed: %s\n",

Loading…
Cancel
Save