mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 07:23:53 +01:00
ircd::net: Tighten assumptions on cancel().
This commit is contained in:
parent
725f069621
commit
a135227370
2 changed files with 8 additions and 10 deletions
|
@ -101,7 +101,7 @@ struct ircd::net::socket
|
|||
void wait(const wait_opts &);
|
||||
void wait(const wait_opts &, wait_callback_ec);
|
||||
void wait(const wait_opts &, wait_callback_eptr);
|
||||
bool cancel() noexcept;
|
||||
void cancel() noexcept;
|
||||
|
||||
// Alias to wait()
|
||||
template<class... args> auto operator()(args&&...);
|
||||
|
|
16
ircd/net.cc
16
ircd/net.cc
|
@ -1365,19 +1365,17 @@ catch(const std::exception &e)
|
|||
throw;
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
ircd::net::socket::cancel()
|
||||
noexcept
|
||||
{
|
||||
static const auto good{[](const auto &ec)
|
||||
{
|
||||
return ec == boost::system::errc::success;
|
||||
}};
|
||||
boost::system::error_code ec;
|
||||
|
||||
boost::system::error_code ec[2];
|
||||
sd.cancel(ec[0]);
|
||||
timer.cancel(ec[1]);
|
||||
return std::all_of(begin(ec), end(ec), good);
|
||||
sd.cancel(ec);
|
||||
assert(!ec);
|
||||
|
||||
timer.cancel(ec);
|
||||
assert(!ec);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue