0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-07-04 17:48:35 +02:00

ircd::net::dns: Post callback away from timeout worker ctx's stack.

This commit is contained in:
Jason Volk 2018-04-07 11:20:22 -07:00
parent fb6a4fc6ac
commit 37a0b0362b

View file

@ -2679,16 +2679,17 @@ ircd::net::dns::resolver::check_timeout(const uint16_t &id,
//TODO: retry
log.error("DNS timeout id:%u", id);
const error_code ec
{
boost::system::errc::timed_out, boost::system::system_category()
};
if(tag.cb)
// Callback gets a fresh stack off this timeout worker ctx's stack.
if(tag.cb) ircd::post([cb(std::move(tag.cb))]
{
using boost::system::system_error;
tag.cb(std::make_exception_ptr(system_error{ec}), {});
}
const error_code ec
{
boost::system::errc::timed_out, boost::system::system_category()
};
cb(std::make_exception_ptr(system_error{ec}), {});
});
return false;
}