Skip to content
This repository was archived by the owner on Oct 28, 2021. It is now read-only.

Commit aecf6c9

Browse files
authored
Merge pull request #5568 from ethereum/p2p-logging
Clean up RLPX handshake logging
2 parents e8c03b3 + 5b85610 commit aecf6c9

File tree

5 files changed

+274
-164
lines changed

5 files changed

+274
-164
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- Added: [#5557](https://github.com/ethereum/aleth/pull/5557) Improved debug logging of full sync.
77
- Changed: [#5559](https://github.com/ethereum/aleth/pull/5559) Update peer validation error messages.
88
- Fixed: [#5562](https://github.com/ethereum/aleth/pull/5562) Don't send header request messages to peers that haven't sent us Status yet.
9+
- Changed: [#5568](https://github.com/ethereum/aleth/pull/5568) Improve rlpx handshake log messages and create new rlpx log channel.
910

1011
## [1.6.0] - Unreleased
1112

libp2p/Common.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,27 @@ using namespace std;
1515
const NodeIPEndpoint UnspecifiedNodeIPEndpoint = NodeIPEndpoint{{}, 0, 0};
1616
const Node UnspecifiedNode = Node{{}, UnspecifiedNodeIPEndpoint};
1717

18+
char const* packetTypeToString(PacketType _packetType)
19+
{
20+
switch (_packetType)
21+
{
22+
case HelloPacket:
23+
return "HelloPacket";
24+
case DisconnectPacket:
25+
return "DisconnectPacket";
26+
case PingPacket:
27+
return "PingPacket";
28+
case PongPacket:
29+
return "PongPacket";
30+
case GetPeersPacket:
31+
return "GetPeersPacket";
32+
case PeersPacket:
33+
return "PeersPacket";
34+
default:
35+
return "UnknownPacket";
36+
}
37+
}
38+
1839
bool isPublicAddress(string const& _addressToCheck)
1940
{
2041
return _addressToCheck.empty() ? false :

libp2p/Common.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ enum PacketType
8989
UserPacket = 0x10
9090
};
9191

92+
char const* packetTypeToString(PacketType _packetType);
93+
9294
enum DisconnectReason
9395
{
9496
DisconnectRequested = 0,
@@ -259,6 +261,11 @@ inline boost::log::formatting_ostream& operator<<(
259261
return _strm;
260262
}
261263

264+
inline std::ostream& operator<<(std::ostream& _strm, NodeID const& _id)
265+
{
266+
_strm << "##" << _id.abridged();
267+
return _strm;
268+
}
262269

263270
/// Simple stream output for a NodeIPEndpoint.
264271
std::ostream& operator<<(std::ostream& _out, NodeIPEndpoint const& _ep);

0 commit comments

Comments
 (0)