#64 key keeper增加evdnsbase参数。
避免创建大量dnsbase,耗尽fd。ssl stream/tcp stream/proxy也做了相应修改。
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include <pthread.h>
|
||||
|
||||
#include <event2/event.h>
|
||||
#include <event2/dns.h>
|
||||
#include <event2/listener.h>
|
||||
#include <event2/bufferevent.h>
|
||||
#include <event2/bufferevent_ssl.h>
|
||||
@@ -210,7 +211,8 @@ void tfe_proxy_work_thread_create_ctx(struct tfe_proxy * proxy)
|
||||
{
|
||||
proxy->work_threads[i] = ALLOC(struct tfe_thread_ctx, 1);
|
||||
proxy->work_threads[i]->thread_id = i;
|
||||
proxy->work_threads[i]->evbase = event_base_new();
|
||||
proxy->work_threads[i]->evbase = event_base_new();
|
||||
proxy->work_threads[i]->dnsbase = evdns_base_new(proxy->work_threads[i]->evbase, EVDNS_BASE_INITIALIZE_NAMESERVERS);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -414,6 +416,12 @@ struct event_base * tfe_proxy_get_work_thread_evbase(unsigned int thread_id)
|
||||
assert(thread_id < g_default_proxy->nr_work_threads);
|
||||
return g_default_proxy->work_threads[thread_id]->evbase;
|
||||
}
|
||||
struct evdns_base* tfe_proxy_get_work_thread_dnsbase(unsigned int thread_id)
|
||||
{
|
||||
assert(thread_id < g_default_proxy->nr_work_threads);
|
||||
return g_default_proxy->work_threads[thread_id]->dnsbase;
|
||||
|
||||
}
|
||||
|
||||
struct event_base * tfe_proxy_get_gc_evbase(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user