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:
parent
dc4d827def
commit
12f1bf97b4
1 changed files with 10 additions and 7 deletions
17
ircd/net.cc
17
ircd/net.cc
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue