aboutsummaryrefslogtreecommitdiff
path: root/src/stream/ngx_stream_proxy_module.c
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@nginx.com>2017-05-26 22:52:48 +0300
committerRuslan Ermilov <ru@nginx.com>2017-05-26 22:52:48 +0300
commitb66c18d2d50c53b063cd14a2c3e4c8ff8b1b22a5 (patch)
treec61e02ac50d38621b454b9972fe42f72fc87f18f /src/stream/ngx_stream_proxy_module.c
parent8644d9491ad3c0eb16bcda1d452aba326e1f4dae (diff)
downloadnginx-b66c18d2d50c53b063cd14a2c3e4c8ff8b1b22a5.tar.gz
nginx-b66c18d2d50c53b063cd14a2c3e4c8ff8b1b22a5.zip
Introduced ngx_tcp_nodelay().
Diffstat (limited to 'src/stream/ngx_stream_proxy_module.c')
-rw-r--r--src/stream/ngx_stream_proxy_module.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/src/stream/ngx_stream_proxy_module.c b/src/stream/ngx_stream_proxy_module.c
index fe52cb6c1..0afde1c40 100644
--- a/src/stream/ngx_stream_proxy_module.c
+++ b/src/stream/ngx_stream_proxy_module.c
@@ -729,7 +729,6 @@ ngx_stream_proxy_connect(ngx_stream_session_t *s)
static void
ngx_stream_proxy_init_upstream(ngx_stream_session_t *s)
{
- int tcp_nodelay;
u_char *p;
ngx_chain_t *cl;
ngx_connection_t *c, *pc;
@@ -745,22 +744,10 @@ ngx_stream_proxy_init_upstream(ngx_stream_session_t *s)
if (pc->type == SOCK_STREAM
&& cscf->tcp_nodelay
- && pc->tcp_nodelay == NGX_TCP_NODELAY_UNSET)
+ && ngx_tcp_nodelay(pc) != NGX_OK)
{
- ngx_log_debug0(NGX_LOG_DEBUG_STREAM, pc->log, 0, "tcp_nodelay");
-
- tcp_nodelay = 1;
-
- if (setsockopt(pc->fd, IPPROTO_TCP, TCP_NODELAY,
- (const void *) &tcp_nodelay, sizeof(int)) == -1)
- {
- ngx_connection_error(pc, ngx_socket_errno,
- "setsockopt(TCP_NODELAY) failed");
- ngx_stream_proxy_next_upstream(s);
- return;
- }
-
- pc->tcp_nodelay = NGX_TCP_NODELAY_SET;
+ ngx_stream_proxy_next_upstream(s);
+ return;
}
pscf = ngx_stream_get_module_srv_conf(s, ngx_stream_proxy_module);