From 3f296f2108c655b95bba4c1fb6ef029631cbdc38 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 9 May 2018 21:12:01 -0700 Subject: [PATCH] ircd::net: Fix error fmtstr; use static exception instance for copy. --- ircd/net.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ircd/net.cc b/ircd/net.cc index 6d1ca8274..fccdc606a 100644 --- a/ircd/net.cc +++ b/ircd/net.cc @@ -1847,9 +1847,7 @@ noexcept try // All other errors are unexpected, logged and ignored here. default: throw assertive { - "unexpected: %s\n", - (const void *)this, - string(ec) + "socket(%p): unexpected: %s\n", (const void *)this, string(ec) }; } else ec = { operation_canceled, system_category() }; @@ -2396,7 +2394,14 @@ ircd::net::dns::operator()(const hostport &hp, return callback(std::move(eptr), hp, {}); if(!ip) - return callback(std::make_exception_ptr(net::not_found{"Host has no A record"}), hp, {}); + { + static const net::not_found no_record + { + "Host has no A record" + }; + + return callback(std::make_exception_ptr(no_record), hp, {}); + } const ipport ipport{ip, port(hp)}; callback(std::move(eptr), hp, ipport);