Latest update - 7307
This commit is contained in:
@@ -281,6 +281,22 @@ ngx_set_inherited_sockets(ngx_cycle_t *cycle)
|
|||||||
reuseport = 0;
|
reuseport = 0;
|
||||||
olen = sizeof(int);
|
olen = sizeof(int);
|
||||||
|
|
||||||
|
#ifdef SO_REUSEPORT_LB
|
||||||
|
|
||||||
|
if (getsockopt(ls[i].fd, SOL_SOCKET, SO_REUSEPORT_LB,
|
||||||
|
(void *) &reuseport, &olen)
|
||||||
|
== -1)
|
||||||
|
{
|
||||||
|
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
|
||||||
|
"getsockopt(SO_REUSEPORT_LB) %V failed, ignored",
|
||||||
|
&ls[i].addr_text);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ls[i].reuseport = reuseport ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
if (getsockopt(ls[i].fd, SOL_SOCKET, SO_REUSEPORT,
|
if (getsockopt(ls[i].fd, SOL_SOCKET, SO_REUSEPORT,
|
||||||
(void *) &reuseport, &olen)
|
(void *) &reuseport, &olen)
|
||||||
== -1)
|
== -1)
|
||||||
@@ -292,6 +308,7 @@ ngx_set_inherited_sockets(ngx_cycle_t *cycle)
|
|||||||
} else {
|
} else {
|
||||||
ls[i].reuseport = reuseport ? 1 : 0;
|
ls[i].reuseport = reuseport ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -430,6 +447,20 @@ ngx_open_listening_sockets(ngx_cycle_t *cycle)
|
|||||||
|
|
||||||
int reuseport = 1;
|
int reuseport = 1;
|
||||||
|
|
||||||
|
#ifdef SO_REUSEPORT_LB
|
||||||
|
|
||||||
|
if (setsockopt(ls[i].fd, SOL_SOCKET, SO_REUSEPORT_LB,
|
||||||
|
(const void *) &reuseport, sizeof(int))
|
||||||
|
== -1)
|
||||||
|
{
|
||||||
|
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
|
||||||
|
"setsockopt(SO_REUSEPORT_LB) %V failed, "
|
||||||
|
"ignored",
|
||||||
|
&ls[i].addr_text);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
if (setsockopt(ls[i].fd, SOL_SOCKET, SO_REUSEPORT,
|
if (setsockopt(ls[i].fd, SOL_SOCKET, SO_REUSEPORT,
|
||||||
(const void *) &reuseport, sizeof(int))
|
(const void *) &reuseport, sizeof(int))
|
||||||
== -1)
|
== -1)
|
||||||
@@ -438,6 +469,7 @@ ngx_open_listening_sockets(ngx_cycle_t *cycle)
|
|||||||
"setsockopt(SO_REUSEPORT) %V failed, ignored",
|
"setsockopt(SO_REUSEPORT) %V failed, ignored",
|
||||||
&ls[i].addr_text);
|
&ls[i].addr_text);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
ls[i].add_reuseport = 0;
|
ls[i].add_reuseport = 0;
|
||||||
}
|
}
|
||||||
@@ -488,6 +520,27 @@ ngx_open_listening_sockets(ngx_cycle_t *cycle)
|
|||||||
|
|
||||||
reuseport = 1;
|
reuseport = 1;
|
||||||
|
|
||||||
|
#ifdef SO_REUSEPORT_LB
|
||||||
|
|
||||||
|
if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT_LB,
|
||||||
|
(const void *) &reuseport, sizeof(int))
|
||||||
|
== -1)
|
||||||
|
{
|
||||||
|
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
|
||||||
|
"setsockopt(SO_REUSEPORT_LB) %V failed",
|
||||||
|
&ls[i].addr_text);
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT,
|
if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT,
|
||||||
(const void *) &reuseport, sizeof(int))
|
(const void *) &reuseport, sizeof(int))
|
||||||
== -1)
|
== -1)
|
||||||
@@ -504,6 +557,7 @@ ngx_open_listening_sockets(ngx_cycle_t *cycle)
|
|||||||
|
|
||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -3868,6 +3868,7 @@ ngx_http_grpc_send_window_update(ngx_http_request_t *r,
|
|||||||
static ngx_chain_t *
|
static ngx_chain_t *
|
||||||
ngx_http_grpc_get_buf(ngx_http_request_t *r, ngx_http_grpc_ctx_t *ctx)
|
ngx_http_grpc_get_buf(ngx_http_request_t *r, ngx_http_grpc_ctx_t *ctx)
|
||||||
{
|
{
|
||||||
|
u_char *start;
|
||||||
ngx_buf_t *b;
|
ngx_buf_t *b;
|
||||||
ngx_chain_t *cl;
|
ngx_chain_t *cl;
|
||||||
|
|
||||||
@@ -3877,29 +3878,33 @@ ngx_http_grpc_get_buf(ngx_http_request_t *r, ngx_http_grpc_ctx_t *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
b = cl->buf;
|
b = cl->buf;
|
||||||
|
start = b->start;
|
||||||
|
|
||||||
b->tag = (ngx_buf_tag_t) &ngx_http_grpc_body_output_filter;
|
if (start == NULL) {
|
||||||
b->temporary = 1;
|
|
||||||
b->flush = 1;
|
|
||||||
|
|
||||||
if (b->start == NULL) {
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* each buffer is large enough to hold two window update
|
* each buffer is large enough to hold two window update
|
||||||
* frames in a row
|
* frames in a row
|
||||||
*/
|
*/
|
||||||
|
|
||||||
b->start = ngx_palloc(r->pool, 2 * sizeof(ngx_http_grpc_frame_t) + 8);
|
start = ngx_palloc(r->pool, 2 * sizeof(ngx_http_grpc_frame_t) + 8);
|
||||||
if (b->start == NULL) {
|
if (start == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
b->pos = b->start;
|
|
||||||
b->last = b->start;
|
|
||||||
|
|
||||||
b->end = b->start + 2 * sizeof(ngx_http_grpc_frame_t) + 8;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngx_memzero(b, sizeof(ngx_buf_t));
|
||||||
|
|
||||||
|
b->start = start;
|
||||||
|
b->pos = start;
|
||||||
|
b->last = start;
|
||||||
|
b->end = start + 2 * sizeof(ngx_http_grpc_frame_t) + 8;
|
||||||
|
|
||||||
|
b->tag = (ngx_buf_tag_t) &ngx_http_grpc_body_output_filter;
|
||||||
|
b->temporary = 1;
|
||||||
|
b->flush = 1;
|
||||||
|
|
||||||
return cl;
|
return cl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1556,6 +1556,10 @@ ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u)
|
|||||||
c->sendfile &= r->connection->sendfile;
|
c->sendfile &= r->connection->sendfile;
|
||||||
u->output.sendfile = c->sendfile;
|
u->output.sendfile = c->sendfile;
|
||||||
|
|
||||||
|
if (r->connection->tcp_nopush == NGX_TCP_NOPUSH_DISABLED) {
|
||||||
|
c->tcp_nopush = NGX_TCP_NOPUSH_DISABLED;
|
||||||
|
}
|
||||||
|
|
||||||
if (c->pool == NULL) {
|
if (c->pool == NULL) {
|
||||||
|
|
||||||
/* we need separate pool here to be able to cache SSL connections */
|
/* we need separate pool here to be able to cache SSL connections */
|
||||||
@@ -2008,6 +2012,18 @@ ngx_http_upstream_send_request(ngx_http_request_t *r, ngx_http_upstream_t *u,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (c->write->ready && c->tcp_nopush == NGX_TCP_NOPUSH_SET) {
|
||||||
|
if (ngx_tcp_push(c->fd) == -1) {
|
||||||
|
ngx_log_error(NGX_LOG_CRIT, c->log, ngx_socket_errno,
|
||||||
|
ngx_tcp_push_n " failed");
|
||||||
|
ngx_http_upstream_finalize_request(r, u,
|
||||||
|
NGX_HTTP_INTERNAL_SERVER_ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
c->tcp_nopush = NGX_TCP_NOPUSH_UNSET;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user