comparison src/http/ngx_http_core_module.c @ 5456:692afcea9d0d

Added support for TCP_FASTOPEN supported in Linux >= 3.7.1. --- auto/unix | 12 ++++++++++++ src/core/ngx_connection.c | 32 ++++++++++++++++++++++++++++++++ src/core/ngx_connection.h | 4 ++++ src/http/ngx_http.c | 4 ++++ src/http/ngx_http_core_module.c | 21 +++++++++++++++++++++ src/http/ngx_http_core_module.h | 3 +++ 6 files changed, 76 insertions(+)
author Mathew Rodley <mathew@rodley.com.au>
date Tue, 03 Dec 2013 22:07:03 +0400
parents 8f2c69418045
children 0251f2f1dc93
comparison
equal deleted inserted replaced
5455:8f2c69418045 5456:692afcea9d0d
3038 lsopt.backlog = NGX_LISTEN_BACKLOG; 3038 lsopt.backlog = NGX_LISTEN_BACKLOG;
3039 lsopt.rcvbuf = -1; 3039 lsopt.rcvbuf = -1;
3040 lsopt.sndbuf = -1; 3040 lsopt.sndbuf = -1;
3041 #if (NGX_HAVE_SETFIB) 3041 #if (NGX_HAVE_SETFIB)
3042 lsopt.setfib = -1; 3042 lsopt.setfib = -1;
3043 #endif
3044 #if (NGX_HAVE_TCP_FASTOPEN)
3045 lsopt.fastopen = -1;
3043 #endif 3046 #endif
3044 lsopt.wildcard = 1; 3047 lsopt.wildcard = 1;
3045 3048
3046 (void) ngx_sock_ntop(&lsopt.u.sockaddr, lsopt.socklen, lsopt.addr, 3049 (void) ngx_sock_ntop(&lsopt.u.sockaddr, lsopt.socklen, lsopt.addr,
3047 NGX_SOCKADDR_STRLEN, 1); 3050 NGX_SOCKADDR_STRLEN, 1);
3987 lsopt.rcvbuf = -1; 3990 lsopt.rcvbuf = -1;
3988 lsopt.sndbuf = -1; 3991 lsopt.sndbuf = -1;
3989 #if (NGX_HAVE_SETFIB) 3992 #if (NGX_HAVE_SETFIB)
3990 lsopt.setfib = -1; 3993 lsopt.setfib = -1;
3991 #endif 3994 #endif
3995 #if (NGX_HAVE_TCP_FASTOPEN)
3996 lsopt.fastopen = -1;
3997 #endif
3992 lsopt.wildcard = u.wildcard; 3998 lsopt.wildcard = u.wildcard;
3993 #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY) 3999 #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
3994 lsopt.ipv6only = 1; 4000 lsopt.ipv6only = 1;
3995 #endif 4001 #endif
3996 4002
4025 } 4031 }
4026 4032
4027 continue; 4033 continue;
4028 } 4034 }
4029 #endif 4035 #endif
4036
4037 #if (NGX_HAVE_TCP_FASTOPEN)
4038 if (ngx_strncmp(value[n].data, "fastopen=", 9) == 0) {
4039 lsopt.fastopen = ngx_atoi(value[n].data + 9, value[n].len - 9);
4040 lsopt.set = 1;
4041 lsopt.bind = 1;
4042
4043 if (lsopt.fastopen == NGX_ERROR) {
4044 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
4045 "invalid fastopen \"%V\"", &value[n]);
4046 return NGX_CONF_ERROR;
4047 }
4048
4049 continue;
4050 }
4051 #endif
4052
4030 if (ngx_strncmp(value[n].data, "backlog=", 8) == 0) { 4053 if (ngx_strncmp(value[n].data, "backlog=", 8) == 0) {
4031 lsopt.backlog = ngx_atoi(value[n].data + 8, value[n].len - 8); 4054 lsopt.backlog = ngx_atoi(value[n].data + 8, value[n].len - 8);
4032 lsopt.set = 1; 4055 lsopt.set = 1;
4033 lsopt.bind = 1; 4056 lsopt.bind = 1;
4034 4057