comparison src/http/ngx_http_request.c @ 7007:ed1101bbf19f

Introduced ngx_tcp_nodelay().
author Ruslan Ermilov <ru@nginx.com>
date Fri, 26 May 2017 22:52:48 +0300
parents 9552758a786e
children 29c6d66b83ba
comparison
equal deleted inserted replaced
7006:9552758a786e 7007:ed1101bbf19f
3059 3059
3060 } else { 3060 } else {
3061 tcp_nodelay = 1; 3061 tcp_nodelay = 1;
3062 } 3062 }
3063 3063
3064 if (tcp_nodelay 3064 if (tcp_nodelay && clcf->tcp_nodelay && ngx_tcp_nodelay(c) != NGX_OK) {
3065 && clcf->tcp_nodelay 3065 ngx_http_close_connection(c);
3066 && c->tcp_nodelay == NGX_TCP_NODELAY_UNSET) 3066 return;
3067 {
3068 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "tcp_nodelay");
3069
3070 if (setsockopt(c->fd, IPPROTO_TCP, TCP_NODELAY,
3071 (const void *) &tcp_nodelay, sizeof(int))
3072 == -1)
3073 {
3074 #if (NGX_SOLARIS)
3075 /* Solaris returns EINVAL if a socket has been shut down */
3076 c->log_error = NGX_ERROR_IGNORE_EINVAL;
3077 #endif
3078
3079 ngx_connection_error(c, ngx_socket_errno,
3080 "setsockopt(TCP_NODELAY) failed");
3081
3082 c->log_error = NGX_ERROR_INFO;
3083 ngx_http_close_connection(c);
3084 return;
3085 }
3086
3087 c->tcp_nodelay = NGX_TCP_NODELAY_SET;
3088 } 3067 }
3089 3068
3090 #if 0 3069 #if 0
3091 /* if ngx_http_request_t was freed then we need some other place */ 3070 /* if ngx_http_request_t was freed then we need some other place */
3092 r->http_state = NGX_HTTP_KEEPALIVE_STATE; 3071 r->http_state = NGX_HTTP_KEEPALIVE_STATE;