0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-27 11:18:51 +02:00

ircd::net: Tweak these error handlers and log facilities.

This commit is contained in:
Jason Volk 2018-01-24 14:32:05 -08:00
parent 7bf9ce225c
commit d56cc60b88
2 changed files with 29 additions and 9 deletions

View file

@ -394,10 +394,13 @@ ircd::handle_ec_timeout(client &client)
try
{
assert(bool(client.sock));
log::warning("socket(%p) local[%s] remote[%s] disconnecting after inactivity timeout",
client.sock.get(),
string(local(client)),
string(remote(client)));
log::debug
{
"socket(%p) local[%s] remote[%s] disconnecting after inactivity timeout",
client.sock.get(),
string(local(client)),
string(remote(client))
};
client.close(net::dc::SSL_NOTIFY, net::close_ignore);
return false;

View file

@ -1045,6 +1045,16 @@ catch(const ctx::interrupted &e)
joining.notify_all();
}
catch(const boost::system::system_error &e)
{
using namespace boost::system::errc;
const auto &fac{e.code() == timed_out? log::DEBUG : log::ERROR};
log(fac, "%s: socket(%p) in handshake(): %s",
std::string(*this),
sock.get(),
string(e));
}
catch(const std::exception &e)
{
log.error("%s: socket(%p) in handshake(): %s",
@ -1061,22 +1071,29 @@ void
ircd::net::listener::acceptor::check_handshake_error(const error_code &ec,
socket &sock)
{
using boost::system::system_error;
using boost::system::system_category;
using namespace boost::system::errc;
if(unlikely(interrupting))
throw ctx::interrupted();
if(likely(ec == success))
return;
if(ec.category() == system_category()) switch(ec.value())
if(likely(ec.category() == system_category())) switch(ec.value())
{
case success:
return;
case operation_canceled:
if(sock.timedout)
throw system_error(timed_out, system_category());
else
break;
default:
break;
}
throw boost::system::system_error(ec);
throw system_error(ec);
}
void