diff options
| author | luqiuwen <[email protected]> | 2018-12-08 20:48:19 +0600 |
|---|---|---|
| committer | luqiuwen <[email protected]> | 2018-12-08 20:48:19 +0600 |
| commit | de92efb3801b0d72c8867faf15106b69b8823412 (patch) | |
| tree | e5f1c7d816510a4919ac5a710670e1b122535754 /platform/src/proxy.cpp | |
| parent | 0b76bdf5e5c8f686709373ad8b07920f2901025d (diff) | |
Close #99 增加全局传输限速功能,增加passthrough状态下eventcb的错误日志
* 增加全局传输限速功能,可以限制上游、下游的传输速度;
* 增加eventcb中的错误日志,当BEV_EVENT_ERROR发生时,打印错误代码与日志信息。
Diffstat (limited to 'platform/src/proxy.cpp')
| -rw-r--r-- | platform/src/proxy.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/platform/src/proxy.cpp b/platform/src/proxy.cpp index 1860581..c5beda0 100644 --- a/platform/src/proxy.cpp +++ b/platform/src/proxy.cpp @@ -238,10 +238,25 @@ int tfe_proxy_config(struct tfe_proxy * proxy, const char * profile) { /* Worker threads */ MESA_load_profile_uint_def(profile, "main", "nr_worker_threads", &proxy->nr_work_threads, 1); + MESA_load_profile_uint_def(profile, "main", "buffer_output_limit", &proxy->buffer_output_limit, 0); /* Debug */ MESA_load_profile_uint_def(profile, "debug", "passthrough_all_tcp", &proxy->tcp_all_passthrough, 0); + /* ratelimit */ + MESA_load_profile_uint_def(profile, "ratelimit", "read_rate", &proxy->rate_limit_options.read_rate, 0); + MESA_load_profile_uint_def(profile, "ratelimit", "read_burst", &proxy->rate_limit_options.read_burst, 0); + MESA_load_profile_uint_def(profile, "ratelimit", "write_rate", &proxy->rate_limit_options.write_rate, 0); + MESA_load_profile_uint_def(profile, "ratelimit", "write_burst", &proxy->rate_limit_options.write_burst, 0); + + if(proxy->rate_limit_options.read_rate != 0 + || proxy->rate_limit_options.read_burst != 0 + || proxy->rate_limit_options.write_rate != 0 + || proxy->rate_limit_options.write_burst != 0) + { + proxy->en_rate_limit = 1; + } + /* TCP options, -1 means unset, we shall not call setsockopt */ MESA_load_profile_int_def(profile, "tcp", "sz_rcv_buffer", &proxy->tcp_options.sz_rcv_buffer, -1); MESA_load_profile_int_def(profile, "tcp", "sz_snd_buffer", &proxy->tcp_options.sz_snd_buffer, -1); |
