开发者

Why does lighttpd mod_fastcgi start a listening socket?

开发者 https://www.devze.com 2023-01-13 01:26 出处:网络
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)) {

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消