mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 23:29:12 +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:
@@ -34,6 +34,7 @@
|
||||
#include <util/check.h> // For NDEBUG compile time check
|
||||
#include <util/strencodings.h>
|
||||
#include <util/system.h>
|
||||
#include <util/trace.h>
|
||||
#include <validation.h>
|
||||
|
||||
#include <algorithm>
|
||||
@@ -4052,6 +4053,15 @@ bool PeerManagerImpl::ProcessMessages(CNode* pfrom, std::atomic<bool>& interrupt
|
||||
}
|
||||
CNetMessage& msg(msgs.front());
|
||||
|
||||
TRACE6(net, inbound_message,
|
||||
pfrom->GetId(),
|
||||
pfrom->GetAddrName().c_str(),
|
||||
pfrom->ConnectionTypeAsString().c_str(),
|
||||
msg.m_command.c_str(),
|
||||
msg.m_recv.size(),
|
||||
msg.m_recv.data()
|
||||
);
|
||||
|
||||
if (gArgs.GetBoolArg("-capturemessages", false)) {
|
||||
CaptureMessage(pfrom->addr, msg.m_command, MakeUCharSpan(msg.m_recv), /* incoming */ true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user