From 63a9f33d7c9f7308d52cd014fd0e4df3c4e6bb4a Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 27 Jul 2019 13:17:34 -0700 Subject: [PATCH] ircd::net: Simplify socket check related. --- include/ircd/net/socket.h | 1 - ircd/net.cc | 23 ++++++++++------------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/include/ircd/net/socket.h b/include/ircd/net/socket.h index 23f28282d..39e1939ef 100644 --- a/include/ircd/net/socket.h +++ b/include/ircd/net/socket.h @@ -100,7 +100,6 @@ struct ircd::net::socket // low level check suite error_code check(std::nothrow_t, const ready &) noexcept; - void check(const ready &); // low level wait suite void wait(const wait_opts &); diff --git a/ircd/net.cc b/ircd/net.cc index dcc241854..173f3b2c5 100644 --- a/ircd/net.cc +++ b/ircd/net.cc @@ -471,7 +471,16 @@ void ircd::net::check(socket &socket, const ready &type) { - socket.check(type); + const error_code ec + { + check(std::nothrow, socket, type) + }; + + if(likely(!ec)) + return; + + throw_system_error(ec); + __builtin_unreachable(); } std::error_code @@ -3142,18 +3151,6 @@ catch(const boost::system::system_error &e) throw_system_error(e); } -void -ircd::net::socket::check(const ready &type) -{ - const error_code ec - { - check(std::nothrow, type) - }; - - if(ec.value()) - throw_system_error(ec); -} - std::error_code ircd::net::socket::check(std::nothrow_t, const ready &type)