From 7d60b6fddcbac3cf8f73ffdaff5abceb34be4f81 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 4 Jul 2022 15:57:23 -0700 Subject: [PATCH] ircd::server: Ensure throwing in case error is set w/o exception; minor cleanup. --- ircd/server.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/ircd/server.cc b/ircd/server.cc index e477b12da..12087e8e2 100644 --- a/ircd/server.cc +++ b/ircd/server.cc @@ -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);