mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-18 22:35:39 +01:00
tracing: Tracepoints for in- and outbound P2P msgs
Can be used to monitor in- and outbound node traffic. Based on ealier work by jb55. Co-authored-by: William Casarin <jb55@jb55.com>
This commit is contained in:
12
src/net.cpp
12
src/net.cpp
@@ -25,6 +25,7 @@
|
||||
#include <util/sock.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <util/thread.h>
|
||||
#include <util/trace.h>
|
||||
#include <util/translation.h>
|
||||
|
||||
#ifdef WIN32
|
||||
@@ -3017,11 +3018,20 @@ bool CConnman::NodeFullyConnected(const CNode* pnode)
|
||||
void CConnman::PushMessage(CNode* pnode, CSerializedNetMsg&& msg)
|
||||
{
|
||||
size_t nMessageSize = msg.data.size();
|
||||
LogPrint(BCLog::NET, "sending %s (%d bytes) peer=%d\n", SanitizeString(msg.m_type), nMessageSize, pnode->GetId());
|
||||
LogPrint(BCLog::NET, "sending %s (%d bytes) peer=%d\n", msg.m_type, nMessageSize, pnode->GetId());
|
||||
if (gArgs.GetBoolArg("-capturemessages", false)) {
|
||||
CaptureMessage(pnode->addr, msg.m_type, msg.data, /* incoming */ false);
|
||||
}
|
||||
|
||||
TRACE6(net, outbound_message,
|
||||
pnode->GetId(),
|
||||
pnode->GetAddrName().c_str(),
|
||||
pnode->ConnectionTypeAsString().c_str(),
|
||||
msg.m_type.c_str(),
|
||||
msg.data.size(),
|
||||
msg.data.data()
|
||||
);
|
||||
|
||||
// make sure we use the appropriate network transport format
|
||||
std::vector<unsigned char> serializedHeader;
|
||||
pnode->m_serializer->prepareForTransport(msg, serializedHeader);
|
||||
|
||||
Reference in New Issue
Block a user