0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-30 17:34:04 +01:00

ircd::net: Move the timedout nulling to here.

This commit is contained in:
Jason Volk 2018-02-06 22:22:54 -08:00
parent dc4d827def
commit 12f1bf97b4

View file

@ -1395,13 +1395,10 @@ void
ircd::net::socket::cancel()
noexcept
{
cancel_timeout();
boost::system::error_code ec;
sd.cancel(ec);
assert(!ec);
timer.cancel(ec);
assert(!ec);
}
void
@ -1992,15 +1989,22 @@ ircd::milliseconds
ircd::net::socket::cancel_timeout()
noexcept
{
const auto ret
const auto exp
{
timer.expires_from_now()
};
const auto ret
{
duration_cast<milliseconds>(exp)
};
boost::system::error_code ec;
timer.cancel(ec);
assert(!ec);
return duration_cast<milliseconds>(ret);
timedout = false;
return ret;
}
void
@ -2014,7 +2018,6 @@ ircd::net::socket::set_timeout(const milliseconds &t,
ec_handler callback)
{
cancel_timeout();
timedout = false;
if(t < milliseconds(0))
return;