From 12f1bf97b409d1411ef7da7210bd1a55e1e5842e Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 6 Feb 2018 22:22:54 -0800 Subject: [PATCH] ircd::net: Move the timedout nulling to here. --- ircd/net.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ircd/net.cc b/ircd/net.cc index c008f97a8..9d2622f88 100644 --- a/ircd/net.cc +++ b/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(exp) + }; + boost::system::error_code ec; timer.cancel(ec); assert(!ec); - return duration_cast(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;