#64 key keeper增加evdnsbase参数。

避免创建大量dnsbase,耗尽fd。ssl stream/tcp stream/proxy也做了相应修改。
This commit is contained in:
zhengchao
2018-11-26 14:54:20 +08:00
parent 880ccbf5ce
commit 3b9e5aca91
13 changed files with 82 additions and 47 deletions

View File

@@ -234,12 +234,13 @@ int main()
MESA_load_profile_string_def(profile, section, "cert_store_host", cert_store_host, sizeof(cert_store_host), "xxxxx");
MESA_load_profile_uint_def(profile, section, "cert_store_port", &cert_store_port, 80);
struct event_base* evbase = event_base_new();
struct evdns_base* dnsbase=evdns_base_new(evbase, EVDNS_BASE_INITIALIZE_NAMESERVERS);
struct future* f_tfe_rpc = future_create("tfe_rpc", tfe_rpc_on_succ, tfe_rpc_on_fail, NULL);
char url[TFE_STRING_MAX];
char sni[TFE_STRING_MAX] = "www.baidu.com";
snprintf(url, TFE_STRING_MAX, "http://%s:%d/ca?host=%s&flag=1&valid=1&kering_id=%d", cert_store_host, cert_store_port, sni, keyring_id);
printf("url is %s\n", url);
tfe_rpc_async_ask(f_tfe_rpc, url, GET, DONE_CB, NULL, 0, evbase);
tfe_rpc_async_ask(f_tfe_rpc, url, GET, DONE_CB, NULL, 0, evbase, dnsbase);
event_base_dispatch(evbase);
}