mirror of
https://github.com/nginx/nginx.git
synced 2025-06-10 19:42:39 +08:00
do listen() just after bind() to exit early
This commit is contained in:
parent
9dd99aac66
commit
d4aa572c8d
@ -325,6 +325,20 @@ ngx_open_listening_sockets(ngx_cycle_t *cycle)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (listen(s, ls[i].backlog) == -1) {
|
||||
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
|
||||
"listen() to %V, backlog %d failed",
|
||||
&ls[i].addr_text, ls[i].backlog);
|
||||
|
||||
if (ngx_close_socket(s) == -1) {
|
||||
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
|
||||
ngx_close_socket_n " %V failed",
|
||||
&ls[i].addr_text);
|
||||
}
|
||||
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
ls[i].listen = 1;
|
||||
|
||||
ls[i].fd = s;
|
||||
|
Loading…
Reference in New Issue
Block a user