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

ircd::net: Improve some error handling and log message related.

This commit is contained in:
Jason Volk 2017-10-15 21:28:40 -07:00
parent 37308b1672
commit 29d9f2bfdb

View file

@ -636,7 +636,7 @@ ircd::net::socket::socket(const ip::tcp::endpoint &remote,
try
:socket{ssl, ios}
{
log::debug("socket(%p) connecting to remote: %s timeout: %ld$ms",
log::debug("socket(%p) attempting connect to remote: %s for the next %ld$ms",
this,
string(remote),
timeout.count());
@ -678,8 +678,21 @@ ircd::net::socket::socket(asio::ssl::context &ssl,
}
ircd::net::socket::~socket()
noexcept
noexcept try
{
if(ctx::current) try
{
disconnect(dc::SSL_NOTIFY_YIELD);
}
catch(const boost::system::system_error &e)
{
log::debug("socket(%p): close: %s", this, e.what());
}
}
catch(const std::exception &e)
{
log::error("socket(%p): close: %s", this, e.what());
return;
}
void
@ -697,6 +710,12 @@ ircd::net::socket::disconnect(const dc &type)
if(timer.expires_from_now() > 0ms)
timer.cancel();
if(sd.is_open())
log::debug("socket(%p): disconnect: %s type: %d",
this,
string(remote()),
uint(type));
if(sd.is_open()) switch(type)
{
default: