增加获取evbase、线程数、标准HTTP field设置的工具函数

This commit is contained in:
zhengchao
2018-10-14 14:07:47 +08:00
parent a2fa705fa7
commit a925bf738e
4 changed files with 42 additions and 9 deletions

View File

@@ -221,7 +221,7 @@ int tfe_proxy_config(struct tfe_proxy * proxy, const char * profile)
MESA_load_profile_uint_def(profile, "main", "nr_worker_threads", &proxy->nr_work_threads, 1);
/* Debug */
MESA_load_profile_uint_def(profile, "debug", "passthrough_all_tcp", &proxy->tcp_all_passthrough, 0);
/* TCP options, -1 means unset, we should not call setsockopt */
/* 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);
MESA_load_profile_int_def(profile, "tcp", "so_keepalive", &proxy->tcp_options.so_keepalive, -1);
@@ -276,6 +276,8 @@ int main(int argc, char *argv[])
future_promise_library_init();
tango_cache_global_init();
/* PROXY INSTANCE */
g_default_proxy = ALLOC(struct tfe_proxy, 1);
assert(g_default_proxy);
@@ -339,3 +341,14 @@ int main(int argc, char *argv[])
return 0;
}
unsigned int tfe_proxy_get_thread_count(void)
{
return g_default_proxy->nr_work_threads;
}
struct event_base * tfe_proxy_get_evbase(unsigned int thread_id)
{
assert(thread_id<g_default_proxy->nr_work_threads);
return g_default_proxy->work_threads[thread_id].evbase;
}