mirror of
https://github.com/matrix-construct/construct
synced 2024-12-27 07:54:05 +01:00
ircd::net: Tweak these error handlers and log facilities.
This commit is contained in:
parent
7bf9ce225c
commit
d56cc60b88
2 changed files with 29 additions and 9 deletions
|
@ -394,10 +394,13 @@ ircd::handle_ec_timeout(client &client)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
assert(bool(client.sock));
|
assert(bool(client.sock));
|
||||||
log::warning("socket(%p) local[%s] remote[%s] disconnecting after inactivity timeout",
|
log::debug
|
||||||
client.sock.get(),
|
{
|
||||||
string(local(client)),
|
"socket(%p) local[%s] remote[%s] disconnecting after inactivity timeout",
|
||||||
string(remote(client)));
|
client.sock.get(),
|
||||||
|
string(local(client)),
|
||||||
|
string(remote(client))
|
||||||
|
};
|
||||||
|
|
||||||
client.close(net::dc::SSL_NOTIFY, net::close_ignore);
|
client.close(net::dc::SSL_NOTIFY, net::close_ignore);
|
||||||
return false;
|
return false;
|
||||||
|
|
27
ircd/net.cc
27
ircd/net.cc
|
@ -1045,6 +1045,16 @@ catch(const ctx::interrupted &e)
|
||||||
|
|
||||||
joining.notify_all();
|
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)
|
catch(const std::exception &e)
|
||||||
{
|
{
|
||||||
log.error("%s: socket(%p) in handshake(): %s",
|
log.error("%s: socket(%p) in handshake(): %s",
|
||||||
|
@ -1061,22 +1071,29 @@ void
|
||||||
ircd::net::listener::acceptor::check_handshake_error(const error_code &ec,
|
ircd::net::listener::acceptor::check_handshake_error(const error_code &ec,
|
||||||
socket &sock)
|
socket &sock)
|
||||||
{
|
{
|
||||||
|
using boost::system::system_error;
|
||||||
using boost::system::system_category;
|
using boost::system::system_category;
|
||||||
using namespace boost::system::errc;
|
using namespace boost::system::errc;
|
||||||
|
|
||||||
if(unlikely(interrupting))
|
if(unlikely(interrupting))
|
||||||
throw ctx::interrupted();
|
throw ctx::interrupted();
|
||||||
|
|
||||||
if(likely(ec == success))
|
if(likely(ec.category() == system_category())) switch(ec.value())
|
||||||
return;
|
|
||||||
|
|
||||||
if(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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw boost::system::system_error(ec);
|
throw system_error(ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue