summaryrefslogtreecommitdiff
path: root/platform/src/proxy.cpp
diff options
context:
space:
mode:
authorzhengchao <[email protected]>2018-10-14 14:07:47 +0800
committerzhengchao <[email protected]>2018-10-14 14:07:47 +0800
commita925bf738ef84ddfe4c9cc850064ddd77be111c1 (patch)
treeec0752b07cff7bb35a6b1e7dc96c378b420e4abb /platform/src/proxy.cpp
parenta2fa705fa7d00fe3937b2097fa33a197293f407c (diff)
增加获取evbase、线程数、标准HTTP field设置的工具函数
Diffstat (limited to 'platform/src/proxy.cpp')
-rw-r--r--platform/src/proxy.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/platform/src/proxy.cpp b/platform/src/proxy.cpp
index c6b778c..96f0c68 100644
--- a/platform/src/proxy.cpp
+++ b/platform/src/proxy.cpp
@@ -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;
+}
+
+