diff options
Diffstat (limited to 'src/stream')
| -rw-r--r-- | src/stream/ngx_stream.c | 4 | ||||
| -rw-r--r-- | src/stream/ngx_stream.h | 3 | ||||
| -rw-r--r-- | src/stream/ngx_stream_core_module.c | 12 |
3 files changed, 19 insertions, 0 deletions
diff --git a/src/stream/ngx_stream.c b/src/stream/ngx_stream.c index 18aea28af..1c5e7a87c 100644 --- a/src/stream/ngx_stream.c +++ b/src/stream/ngx_stream.c @@ -410,6 +410,10 @@ ngx_stream_optimize_servers(ngx_conf_t *cf, ngx_array_t *ports) break; } + if (ngx_clone_listening(cf, ls) != NGX_OK) { + return NGX_CONF_ERROR; + } + addr++; last--; } diff --git a/src/stream/ngx_stream.h b/src/stream/ngx_stream.h index 83a43a41f..a10f68fff 100644 --- a/src/stream/ngx_stream.h +++ b/src/stream/ngx_stream.h @@ -45,6 +45,9 @@ typedef struct { #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY) unsigned ipv6only:1; #endif +#if (NGX_HAVE_REUSEPORT) + unsigned reuseport:1; +#endif unsigned so_keepalive:2; #if (NGX_HAVE_KEEPALIVE_TUNABLE) int tcp_keepidle; diff --git a/src/stream/ngx_stream_core_module.c b/src/stream/ngx_stream_core_module.c index c0df412a5..c8d8e66bc 100644 --- a/src/stream/ngx_stream_core_module.c +++ b/src/stream/ngx_stream_core_module.c @@ -384,6 +384,18 @@ ngx_stream_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) #endif } + if (ngx_strcmp(value[i].data, "reuseport") == 0) { +#if (NGX_HAVE_REUSEPORT) + ls->reuseport = 1; + ls->bind = 1; +#else + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "reuseport is not supported " + "on this platform, ignored"); +#endif + continue; + } + if (ngx_strcmp(value[i].data, "ssl") == 0) { #if (NGX_STREAM_SSL) ls->ssl = 1; |
