0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 02:02:38 +01:00

ircd::net: Update socket handler conditions to ignore timeout if data is there too.

This commit is contained in:
Jason Volk 2018-02-27 17:20:31 -08:00
parent a5389dfd95
commit 03034723df

View file

@ -1534,10 +1534,10 @@ noexcept try
if(!timedout) if(!timedout)
cancel_timeout(); cancel_timeout();
else else if(ec == operation_canceled && ec.category() == system_category())
ec = { timed_out, system_category() }; ec = { timed_out, system_category() };
if(!ec && !sd.is_open()) if(unlikely(!ec && !sd.is_open()))
ec = { bad_file_descriptor, system_category() }; ec = { bad_file_descriptor, system_category() };
log.debug("socket(%p) local[%s] remote[%s] ready %s %s available:%zu", log.debug("socket(%p) local[%s] remote[%s] ready %s %s available:%zu",
@ -1652,12 +1652,10 @@ noexcept try
string(ec)); string(ec));
// The timer was set by socket::connect() and may need to be canceled. // The timer was set by socket::connect() and may need to be canceled.
if(timedout) if(!timedout)
{ cancel_timeout();
assert(ec == operation_canceled); else if(ec == operation_canceled && ec.category() == system_category())
ec = { timed_out, system_category() }; ec = { timed_out, system_category() };
}
else cancel_timeout();
// A connect error; abort here by calling the user back with error. // A connect error; abort here by calling the user back with error.
if(ec) if(ec)
@ -1713,12 +1711,10 @@ noexcept try
using namespace boost::system::errc; using namespace boost::system::errc;
using boost::system::system_category; using boost::system::system_category;
if(timedout) if(!timedout)
{ cancel_timeout();
assert(ec == operation_canceled); else if(ec == operation_canceled && ec.category() == system_category())
ec = { timed_out, system_category() }; ec = { timed_out, system_category() };
}
else cancel_timeout();
log.debug("socket(%p) local[%s] remote[%s] disconnect %s", log.debug("socket(%p) local[%s] remote[%s] disconnect %s",
this, this,
@ -1764,12 +1760,10 @@ noexcept try
const life_guard<socket> s{wp}; const life_guard<socket> s{wp};
if(timedout) if(!timedout)
{ cancel_timeout();
assert(ec == operation_canceled); else if(ec == operation_canceled && ec.category() == system_category())
ec = { timed_out, system_category() }; ec = { timed_out, system_category() };
}
else cancel_timeout();
log.debug("socket(%p) local[%s] remote[%s] handshake %s", log.debug("socket(%p) local[%s] remote[%s] handshake %s",
this, this,