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

Commit

Permalink
Merge pull request #5568 from ethereum/p2p-logging
Browse files Browse the repository at this point in the history
Clean up RLPX handshake logging
  • Loading branch information
halfalicious committed Apr 16, 2019
2 parents e8c03b3 + 5b85610 commit aecf6c9
Show file tree
Hide file tree
Showing 5 changed files with 274 additions and 164 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Added: [#5557](https://github.com/ethereum/aleth/pull/5557) Improved debug logging of full sync.
- Changed: [#5559](https://github.com/ethereum/aleth/pull/5559) Update peer validation error messages.
- Fixed: [#5562](https://github.com/ethereum/aleth/pull/5562) Don't send header request messages to peers that haven't sent us Status yet.
- Changed: [#5568](https://github.com/ethereum/aleth/pull/5568) Improve rlpx handshake log messages and create new rlpx log channel.

## [1.6.0] - Unreleased

Expand Down
21 changes: 21 additions & 0 deletions libp2p/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,27 @@ using namespace std;
const NodeIPEndpoint UnspecifiedNodeIPEndpoint = NodeIPEndpoint{{}, 0, 0};
const Node UnspecifiedNode = Node{{}, UnspecifiedNodeIPEndpoint};

char const* packetTypeToString(PacketType _packetType)
{
switch (_packetType)
{
case HelloPacket:
return "HelloPacket";
case DisconnectPacket:
return "DisconnectPacket";
case PingPacket:
return "PingPacket";
case PongPacket:
return "PongPacket";
case GetPeersPacket:
return "GetPeersPacket";
case PeersPacket:
return "PeersPacket";
default:
return "UnknownPacket";
}
}

bool isPublicAddress(string const& _addressToCheck)
{
return _addressToCheck.empty() ? false :
Expand Down
7 changes: 7 additions & 0 deletions libp2p/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ enum PacketType
UserPacket = 0x10
};

char const* packetTypeToString(PacketType _packetType);

enum DisconnectReason
{
DisconnectRequested = 0,
Expand Down Expand Up @@ -259,6 +261,11 @@ inline boost::log::formatting_ostream& operator<<(
return _strm;
}

inline std::ostream& operator<<(std::ostream& _strm, NodeID const& _id)
{
_strm << "##" << _id.abridged();
return _strm;
}

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

0 comments on commit aecf6c9

Please sign in to comment.