transport layer logging

This commit is contained in:
Valentin Balaschenko
2025-05-06 16:52:09 -04:00
parent 9ec2d7f8ff
commit 320d9345d1
4 changed files with 72 additions and 5 deletions

View File

@@ -134,6 +134,9 @@ Logs::File::writeln(char const* text)
Logs::Logs(beast::severities::Severity thresh)
: thresh_(thresh) // default severity
{
asioBuf_ = std::make_unique<AsioTrackingBuf>(journal("AsioTracking"));
asioStream_ = std::make_unique<std::ostream>(asioBuf_.get());
std::clog.rdbuf(asioStream_->rdbuf());
}
bool

View File

@@ -580,8 +580,21 @@ PeerImp::close()
{
detaching_ = true; // DEPRECATED
error_code ec;
timer_.cancel(ec);
if (ec)
{
JLOG(journal_.info())
<< "PeerImp::close timer_.cancel ec: " << ec.message();
}
socket_.close(ec);
if (ec)
{
JLOG(journal_.info())
<< "PeerImp::close socket_.close ec: " << ec.message();
}
overlay_.incPeerDisconnect();
if (inbound_)
{
@@ -601,7 +614,7 @@ PeerImp::fail(std::string const& reason)
return post(
strand_,
std::bind(
(void(Peer::*)(std::string const&)) & PeerImp::fail,
(void (Peer::*)(std::string const&))&PeerImp::fail,
shared_from_this(),
reason));
if (journal_.active(beast::severities::kWarning) && socket_.is_open())
@@ -672,6 +685,10 @@ PeerImp::cancelTimer()
{
error_code ec;
timer_.cancel(ec);
if (ec)
{
JLOG(journal_.info()) << "PeerImp::cancelTimer ec: " << ec.message();
}
}
//------------------------------------------------------------------------------
@@ -1485,8 +1502,9 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMProofPathRequest> const& m)
}
else
{
peer->send(std::make_shared<Message>(
reply, protocol::mtPROOF_PATH_RESPONSE));
peer->send(
std::make_shared<Message>(
reply, protocol::mtPROOF_PATH_RESPONSE));
}
}
});
@@ -1540,8 +1558,9 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMReplayDeltaRequest> const& m)
}
else
{
peer->send(std::make_shared<Message>(
reply, protocol::mtREPLAY_DELTA_RESPONSE));
peer->send(
std::make_shared<Message>(
reply, protocol::mtREPLAY_DELTA_RESPONSE));
}
}
});