Why does lighttpd mod_fastcgi start a listening socket?
I read in lighttpd 1.4.19 source codes, now I got stuck at the function fcgi_spawn_connection,
if (-1 == connec开发者_JAVA技巧t(fcgi_fd, fcgi_addr, servlen)) { ... bind(fcgi_fd, fcgi_addr, servlen) ... listen(fcgi_fd, 1024) }
The question is, why does mod_fastcgi create a listening socket, what's it use for? Isn't that mod_fastcgi works as client connect to fastcgi processes(etc, php-cgi)? - the php-cgi processes will listen.
Thanks.
OK, I thought i got it.
the php-cgi will not create a listen socket, but inherits from fcgi_spawn_connection, while this listen socket has been dup2 FCGI_LISTENSOCK_FILENO(usually 0).
精彩评论