Latest update - 7371
This commit is contained in:
@@ -20,7 +20,7 @@ static ngx_int_t ngx_event_connect_set_transparent(ngx_peer_connection_t *pc,
|
||||
ngx_int_t
|
||||
ngx_event_connect_peer(ngx_peer_connection_t *pc)
|
||||
{
|
||||
int rc, type;
|
||||
int rc, type, value;
|
||||
#if (NGX_HAVE_IP_BIND_ADDRESS_NO_PORT || NGX_LINUX)
|
||||
in_port_t port;
|
||||
#endif
|
||||
@@ -73,6 +73,18 @@ ngx_event_connect_peer(ngx_peer_connection_t *pc)
|
||||
}
|
||||
}
|
||||
|
||||
if (pc->so_keepalive) {
|
||||
value = 1;
|
||||
|
||||
if (setsockopt(s, SOL_SOCKET, SO_KEEPALIVE,
|
||||
(const void *) &value, sizeof(int))
|
||||
== -1)
|
||||
{
|
||||
ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno,
|
||||
"setsockopt(SO_KEEPALIVE) failed, ignored");
|
||||
}
|
||||
}
|
||||
|
||||
if (ngx_nonblocking(s) == -1) {
|
||||
ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno,
|
||||
ngx_nonblocking_n " failed");
|
||||
|
||||
@@ -62,6 +62,7 @@ struct ngx_peer_connection_s {
|
||||
|
||||
unsigned cached:1;
|
||||
unsigned transparent:1;
|
||||
unsigned so_keepalive:1;
|
||||
|
||||
/* ngx_connection_log_error_e */
|
||||
unsigned log_error:2;
|
||||
|
||||
Reference in New Issue
Block a user