mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 02:02:38 +01:00
ircd::net: Simplify socket check related.
This commit is contained in:
parent
9391ee38f4
commit
63a9f33d7c
2 changed files with 10 additions and 14 deletions
|
@ -100,7 +100,6 @@ struct ircd::net::socket
|
||||||
|
|
||||||
// low level check suite
|
// low level check suite
|
||||||
error_code check(std::nothrow_t, const ready &) noexcept;
|
error_code check(std::nothrow_t, const ready &) noexcept;
|
||||||
void check(const ready &);
|
|
||||||
|
|
||||||
// low level wait suite
|
// low level wait suite
|
||||||
void wait(const wait_opts &);
|
void wait(const wait_opts &);
|
||||||
|
|
23
ircd/net.cc
23
ircd/net.cc
|
@ -471,7 +471,16 @@ void
|
||||||
ircd::net::check(socket &socket,
|
ircd::net::check(socket &socket,
|
||||||
const ready &type)
|
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
|
std::error_code
|
||||||
|
@ -3142,18 +3151,6 @@ catch(const boost::system::system_error &e)
|
||||||
throw_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
|
std::error_code
|
||||||
ircd::net::socket::check(std::nothrow_t,
|
ircd::net::socket::check(std::nothrow_t,
|
||||||
const ready &type)
|
const ready &type)
|
||||||
|
|
Loading…
Reference in a new issue