comparison src/stream/ngx_stream_proxy_module.c @ 6208:7a14a0d754ad

Stream: renamed rate limiting directives. The directive proxy_downstream_limit_rate is now called proxy_upload_rate. The directive proxy_upstream_limit_rate is now called proxy_download_rate.
author Roman Arutyunyan <arut@nginx.com>
date Tue, 14 Jul 2015 09:38:13 -0700
parents 114d1f8cdcab
children 8ee6a08ea3eb
comparison
equal deleted inserted replaced
6207:8bd97db72074 6208:7a14a0d754ad
16 typedef struct { 16 typedef struct {
17 ngx_msec_t connect_timeout; 17 ngx_msec_t connect_timeout;
18 ngx_msec_t timeout; 18 ngx_msec_t timeout;
19 ngx_msec_t next_upstream_timeout; 19 ngx_msec_t next_upstream_timeout;
20 size_t downstream_buf_size; 20 size_t downstream_buf_size;
21 size_t downstream_limit_rate; 21 size_t upload_rate;
22 size_t upstream_buf_size; 22 size_t upstream_buf_size;
23 size_t upstream_limit_rate; 23 size_t download_rate;
24 ngx_uint_t next_upstream_tries; 24 ngx_uint_t next_upstream_tries;
25 ngx_flag_t next_upstream; 25 ngx_flag_t next_upstream;
26 ngx_flag_t proxy_protocol; 26 ngx_flag_t proxy_protocol;
27 ngx_addr_t *local; 27 ngx_addr_t *local;
28 28
132 ngx_conf_set_size_slot, 132 ngx_conf_set_size_slot,
133 NGX_STREAM_SRV_CONF_OFFSET, 133 NGX_STREAM_SRV_CONF_OFFSET,
134 offsetof(ngx_stream_proxy_srv_conf_t, downstream_buf_size), 134 offsetof(ngx_stream_proxy_srv_conf_t, downstream_buf_size),
135 NULL }, 135 NULL },
136 136
137 { ngx_string("proxy_downstream_limit_rate"), 137 { ngx_string("proxy_upload_rate"),
138 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, 138 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1,
139 ngx_conf_set_size_slot, 139 ngx_conf_set_size_slot,
140 NGX_STREAM_SRV_CONF_OFFSET, 140 NGX_STREAM_SRV_CONF_OFFSET,
141 offsetof(ngx_stream_proxy_srv_conf_t, downstream_limit_rate), 141 offsetof(ngx_stream_proxy_srv_conf_t, upload_rate),
142 NULL }, 142 NULL },
143 143
144 { ngx_string("proxy_upstream_buffer"), 144 { ngx_string("proxy_upstream_buffer"),
145 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, 145 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1,
146 ngx_conf_set_size_slot, 146 ngx_conf_set_size_slot,
147 NGX_STREAM_SRV_CONF_OFFSET, 147 NGX_STREAM_SRV_CONF_OFFSET,
148 offsetof(ngx_stream_proxy_srv_conf_t, upstream_buf_size), 148 offsetof(ngx_stream_proxy_srv_conf_t, upstream_buf_size),
149 NULL }, 149 NULL },
150 150
151 { ngx_string("proxy_upstream_limit_rate"), 151 { ngx_string("proxy_download_rate"),
152 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, 152 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1,
153 ngx_conf_set_size_slot, 153 ngx_conf_set_size_slot,
154 NGX_STREAM_SRV_CONF_OFFSET, 154 NGX_STREAM_SRV_CONF_OFFSET,
155 offsetof(ngx_stream_proxy_srv_conf_t, upstream_limit_rate), 155 offsetof(ngx_stream_proxy_srv_conf_t, download_rate),
156 NULL }, 156 NULL },
157 157
158 { ngx_string("proxy_next_upstream"), 158 { ngx_string("proxy_next_upstream"),
159 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_FLAG, 159 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_FLAG,
160 ngx_conf_set_flag_slot, 160 ngx_conf_set_flag_slot,
1008 1008
1009 if (from_upstream) { 1009 if (from_upstream) {
1010 src = pc; 1010 src = pc;
1011 dst = c; 1011 dst = c;
1012 b = &u->upstream_buf; 1012 b = &u->upstream_buf;
1013 limit_rate = pscf->upstream_limit_rate; 1013 limit_rate = pscf->download_rate;
1014 received = &u->received; 1014 received = &u->received;
1015 1015
1016 } else { 1016 } else {
1017 src = c; 1017 src = c;
1018 dst = pc; 1018 dst = pc;
1019 b = &u->downstream_buf; 1019 b = &u->downstream_buf;
1020 limit_rate = pscf->downstream_limit_rate; 1020 limit_rate = pscf->upload_rate;
1021 received = &s->received; 1021 received = &s->received;
1022 } 1022 }
1023 1023
1024 for ( ;; ) { 1024 for ( ;; ) {
1025 1025
1294 1294
1295 conf->connect_timeout = NGX_CONF_UNSET_MSEC; 1295 conf->connect_timeout = NGX_CONF_UNSET_MSEC;
1296 conf->timeout = NGX_CONF_UNSET_MSEC; 1296 conf->timeout = NGX_CONF_UNSET_MSEC;
1297 conf->next_upstream_timeout = NGX_CONF_UNSET_MSEC; 1297 conf->next_upstream_timeout = NGX_CONF_UNSET_MSEC;
1298 conf->downstream_buf_size = NGX_CONF_UNSET_SIZE; 1298 conf->downstream_buf_size = NGX_CONF_UNSET_SIZE;
1299 conf->downstream_limit_rate = NGX_CONF_UNSET_SIZE; 1299 conf->upload_rate = NGX_CONF_UNSET_SIZE;
1300 conf->upstream_buf_size = NGX_CONF_UNSET_SIZE; 1300 conf->upstream_buf_size = NGX_CONF_UNSET_SIZE;
1301 conf->upstream_limit_rate = NGX_CONF_UNSET_SIZE; 1301 conf->download_rate = NGX_CONF_UNSET_SIZE;
1302 conf->next_upstream_tries = NGX_CONF_UNSET_UINT; 1302 conf->next_upstream_tries = NGX_CONF_UNSET_UINT;
1303 conf->next_upstream = NGX_CONF_UNSET; 1303 conf->next_upstream = NGX_CONF_UNSET;
1304 conf->proxy_protocol = NGX_CONF_UNSET; 1304 conf->proxy_protocol = NGX_CONF_UNSET;
1305 conf->local = NGX_CONF_UNSET_PTR; 1305 conf->local = NGX_CONF_UNSET_PTR;
1306 1306
1333 prev->next_upstream_timeout, 0); 1333 prev->next_upstream_timeout, 0);
1334 1334
1335 ngx_conf_merge_size_value(conf->downstream_buf_size, 1335 ngx_conf_merge_size_value(conf->downstream_buf_size,
1336 prev->downstream_buf_size, 16384); 1336 prev->downstream_buf_size, 16384);
1337 1337
1338 ngx_conf_merge_size_value(conf->downstream_limit_rate, 1338 ngx_conf_merge_size_value(conf->upload_rate,
1339 prev->downstream_limit_rate, 0); 1339 prev->upload_rate, 0);
1340 1340
1341 ngx_conf_merge_size_value(conf->upstream_buf_size, 1341 ngx_conf_merge_size_value(conf->upstream_buf_size,
1342 prev->upstream_buf_size, 16384); 1342 prev->upstream_buf_size, 16384);
1343 1343
1344 ngx_conf_merge_size_value(conf->upstream_limit_rate, 1344 ngx_conf_merge_size_value(conf->download_rate,
1345 prev->upstream_limit_rate, 0); 1345 prev->download_rate, 0);
1346 1346
1347 ngx_conf_merge_uint_value(conf->next_upstream_tries, 1347 ngx_conf_merge_uint_value(conf->next_upstream_tries,
1348 prev->next_upstream_tries, 0); 1348 prev->next_upstream_tries, 0);
1349 1349
1350 ngx_conf_merge_value(conf->next_upstream, prev->next_upstream, 1); 1350 ngx_conf_merge_value(conf->next_upstream, prev->next_upstream, 1);