Merge pull request #3602

a9cc88ee common: make this build with unbound 1.4.20 (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2018-04-12 13:48:12 +02:00
commit 1e9cc3e43e
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
2 changed files with 5 additions and 2 deletions

View File

@ -230,7 +230,7 @@ DNSResolver::DNSResolver() : m_data(new DNSResolverData())
if (use_dns_public) if (use_dns_public)
{ {
for (const auto &ip: dns_public_addr) for (const auto &ip: dns_public_addr)
ub_ctx_set_fwd(m_data->m_ub_context, ip.c_str()); ub_ctx_set_fwd(m_data->m_ub_context, string_copy(ip.c_str()));
ub_ctx_set_option(m_data->m_ub_context, string_copy("do-udp:"), string_copy("no")); ub_ctx_set_option(m_data->m_ub_context, string_copy("do-udp:"), string_copy("no"));
ub_ctx_set_option(m_data->m_ub_context, string_copy("do-tcp:"), string_copy("yes")); ub_ctx_set_option(m_data->m_ub_context, string_copy("do-tcp:"), string_copy("yes"));
} }

View File

@ -527,7 +527,10 @@ std::string get_nix_version_display_string()
{ {
ub_ctx *ctx = ub_ctx_create(); ub_ctx *ctx = ub_ctx_create();
if (!ctx) return false; // cheat a bit, should not happen unless OOM if (!ctx) return false; // cheat a bit, should not happen unless OOM
ub_ctx_zone_add(ctx, "monero", "unbound"); // this calls ub_ctx_finalize first, then errors out with UB_SYNTAX char *monero = strdup("monero"), *unbound = strdup("unbound");
ub_ctx_zone_add(ctx, monero, unbound); // this calls ub_ctx_finalize first, then errors out with UB_SYNTAX
free(unbound);
free(monero);
// if no threads, bails out early with UB_NOERROR, otherwise fails with UB_AFTERFINAL id already finalized // if no threads, bails out early with UB_NOERROR, otherwise fails with UB_AFTERFINAL id already finalized
bool with_threads = ub_ctx_async(ctx, 1) != 0; // UB_AFTERFINAL is not defined in public headers, check any error bool with_threads = ub_ctx_async(ctx, 1) != 0; // UB_AFTERFINAL is not defined in public headers, check any error
ub_ctx_delete(ctx); ub_ctx_delete(ctx);