comparison src/http/modules/ngx_http_grpc_module.c @ 7371:8b68d50090e4

Upstream: proxy_socket_keepalive and friends. The directives enable the use of the SO_KEEPALIVE option on upstream connections. By default, the value is left unchanged.
author Vladimir Homutov <vl@nginx.com>
date Wed, 03 Oct 2018 14:08:51 +0300
parents 67c6cb7f477c
children 57463f4e2fcd
comparison
equal deleted inserted replaced
7370:aa1c9f846567 7371:8b68d50090e4
244 { ngx_string("grpc_bind"), 244 { ngx_string("grpc_bind"),
245 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE12, 245 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE12,
246 ngx_http_upstream_bind_set_slot, 246 ngx_http_upstream_bind_set_slot,
247 NGX_HTTP_LOC_CONF_OFFSET, 247 NGX_HTTP_LOC_CONF_OFFSET,
248 offsetof(ngx_http_grpc_loc_conf_t, upstream.local), 248 offsetof(ngx_http_grpc_loc_conf_t, upstream.local),
249 NULL },
250
251 { ngx_string("grpc_socket_keepalive"),
252 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
253 ngx_conf_set_flag_slot,
254 NGX_HTTP_LOC_CONF_OFFSET,
255 offsetof(ngx_http_grpc_loc_conf_t, upstream.socket_keepalive),
249 NULL }, 256 NULL },
250 257
251 { ngx_string("grpc_connect_timeout"), 258 { ngx_string("grpc_connect_timeout"),
252 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, 259 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
253 ngx_conf_set_msec_slot, 260 ngx_conf_set_msec_slot,
4148 * conf->ssl_certificate = { 0, NULL }; 4155 * conf->ssl_certificate = { 0, NULL };
4149 * conf->ssl_certificate_key = { 0, NULL }; 4156 * conf->ssl_certificate_key = { 0, NULL };
4150 */ 4157 */
4151 4158
4152 conf->upstream.local = NGX_CONF_UNSET_PTR; 4159 conf->upstream.local = NGX_CONF_UNSET_PTR;
4160 conf->upstream.socket_keepalive = NGX_CONF_UNSET;
4153 conf->upstream.next_upstream_tries = NGX_CONF_UNSET_UINT; 4161 conf->upstream.next_upstream_tries = NGX_CONF_UNSET_UINT;
4154 conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC; 4162 conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC;
4155 conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC; 4163 conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC;
4156 conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC; 4164 conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC;
4157 conf->upstream.next_upstream_timeout = NGX_CONF_UNSET_MSEC; 4165 conf->upstream.next_upstream_timeout = NGX_CONF_UNSET_MSEC;
4203 ngx_http_core_loc_conf_t *clcf; 4211 ngx_http_core_loc_conf_t *clcf;
4204 4212
4205 ngx_conf_merge_ptr_value(conf->upstream.local, 4213 ngx_conf_merge_ptr_value(conf->upstream.local,
4206 prev->upstream.local, NULL); 4214 prev->upstream.local, NULL);
4207 4215
4216 ngx_conf_merge_value(conf->upstream.socket_keepalive,
4217 prev->upstream.socket_keepalive, 0);
4218
4208 ngx_conf_merge_uint_value(conf->upstream.next_upstream_tries, 4219 ngx_conf_merge_uint_value(conf->upstream.next_upstream_tries,
4209 prev->upstream.next_upstream_tries, 0); 4220 prev->upstream.next_upstream_tries, 0);
4210 4221
4211 ngx_conf_merge_msec_value(conf->upstream.connect_timeout, 4222 ngx_conf_merge_msec_value(conf->upstream.connect_timeout,
4212 prev->upstream.connect_timeout, 60000); 4223 prev->upstream.connect_timeout, 60000);