0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-01 19:22:53 +01:00

ircd::server: Handle exception when starting DNS resolution for peer.

This commit is contained in:
Jason Volk 2019-06-27 00:36:59 -07:00
parent 7494efe743
commit a21f054cfc

View file

@ -1132,6 +1132,7 @@ ircd::server::peer::resolve(const hostport &hostport)
void
ircd::server::peer::resolve(const hostport &hostport,
const net::dns::opts &opts)
try
{
if(op_resolve || op_fini)
return;
@ -1164,6 +1165,22 @@ ircd::server::peer::resolve(const hostport &hostport,
assert(ctx::current); // sorry, ircd::ctx required for now.
net::dns::resolve(hostport, opts, std::move(handler));
}
catch(const std::exception &e)
{
thread_local char buf[256];
log::error
{
log, "peer(%p) DNS resolution for '%s' :%s",
this,
string(buf, hostport),
e.what()
};
op_resolve = false;
err_set(std::current_exception());
if(unlikely(ircd::run::level != ircd::run::level::RUN))
op_fini = true;
}
void
ircd::server::peer::handle_resolve_SRV(const hostport &hp,