Mercurial > hg > nginx
diff 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 |
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -3041,6 +3041,9 @@ ngx_http_core_server(ngx_conf_t *cf, ngx #if (NGX_HAVE_SETFIB) lsopt.setfib = -1; #endif +#if (NGX_HAVE_TCP_FASTOPEN) + lsopt.fastopen = -1; +#endif lsopt.wildcard = 1; (void) ngx_sock_ntop(&lsopt.u.sockaddr, lsopt.socklen, lsopt.addr, @@ -3989,6 +3992,9 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx #if (NGX_HAVE_SETFIB) lsopt.setfib = -1; #endif +#if (NGX_HAVE_TCP_FASTOPEN) + lsopt.fastopen = -1; +#endif lsopt.wildcard = u.wildcard; #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY) lsopt.ipv6only = 1; @@ -4027,6 +4033,23 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx continue; } #endif + +#if (NGX_HAVE_TCP_FASTOPEN) + if (ngx_strncmp(value[n].data, "fastopen=", 9) == 0) { + lsopt.fastopen = ngx_atoi(value[n].data + 9, value[n].len - 9); + lsopt.set = 1; + lsopt.bind = 1; + + if (lsopt.fastopen == NGX_ERROR) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid fastopen \"%V\"", &value[n]); + return NGX_CONF_ERROR; + } + + continue; + } +#endif + if (ngx_strncmp(value[n].data, "backlog=", 8) == 0) { lsopt.backlog = ngx_atoi(value[n].data + 8, value[n].len - 8); lsopt.set = 1;