ircd::server: Ensure throwing in case error is set w/o exception; minor cleanup.

This commit is contained in:
Jason Volk 2022-07-04 15:57:23 -07:00
parent 4b61ea5387
commit 7d60b6fddc
1 changed files with 12 additions and 6 deletions

View File

@ -1130,15 +1130,21 @@ ircd::server::peer::link_add(const size_t &num)
{
assert(!finished());
if(e)
{
if(e && e->eptr)
std::rethrow_exception(e->eptr);
__builtin_unreachable();
}
assert(!e);
if(unlikely(e))
throw unavailable
{
"Cannot add link to peer %s."
};
assert(!op_fini);
links.emplace_back(*this);
auto &link{links.back()};
auto &link
{
links.emplace_back(*this)
};
if(remote)
link.open(open_opts);