0
0
Fork 0
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:
Jason Volk 2018-01-11 18:39:24 -08:00
parent 725f069621
commit a135227370
2 changed files with 8 additions and 10 deletions

View file

@ -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&&...);

View file

@ -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