mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 18:22:50 +01:00
ircd::server: Handle exception when starting DNS resolution for peer.
This commit is contained in:
parent
7494efe743
commit
a21f054cfc
1 changed files with 17 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue