From bf4dedf92c6a7a863128003b3cfbc4d2da83bf41 Mon Sep 17 00:00:00 2001 From: subtly Date: Thu, 12 Mar 2015 00:30:43 +0100 Subject: [PATCH 1/2] Reduce log verbosity. Fix typo for 'recving ack' error. --- libp2p/RLPxHandshake.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libp2p/RLPxHandshake.cpp b/libp2p/RLPxHandshake.cpp index 4f5c70802..b6df5f8e0 100644 --- a/libp2p/RLPxHandshake.cpp +++ b/libp2p/RLPxHandshake.cpp @@ -98,7 +98,7 @@ void RLPXHandshake::readAuth() } else { - clog(NetWarn) << "p2p.connect.egress recving auth decrypt failed for" << m_socket->remoteEndpoint(); + clog(NetConnect) << "p2p.connect.ingress recving auth decrypt failed for" << m_socket->remoteEndpoint(); m_nextState = Error; transition(); } @@ -122,7 +122,7 @@ void RLPXHandshake::readAck() } else { - clog(NetWarn) << "p2p.connect.egress recving ack decrypt failed for " << m_socket->remoteEndpoint(); + clog(NetConnect) << "p2p.connect.egress recving ack decrypt failed for " << m_socket->remoteEndpoint(); m_nextState = Error; transition(); } @@ -162,11 +162,7 @@ void RLPXHandshake::transition(boost::system::error_code _ech) else if (m_nextState == WriteHello) { m_nextState = ReadHello; - - if (m_originated) - clog(NetConnect) << "p2p.connect.egress sending capabilities handshake"; - else - clog(NetConnect) << "p2p.connect.ingress sending capabilities handshake"; + clog(NetConnect) << (m_originated ? "p2p.connect.egress" : "p2p.connect.ingress") << "sending capabilities handshake"; /// This pointer will be freed if there is an error otherwise /// it will be passed to Host which will take ownership. From b4661aeb4c3561319c02e148fff1fccee52d4b5f Mon Sep 17 00:00:00 2001 From: subtly Date: Thu, 12 Mar 2015 00:42:37 +0100 Subject: [PATCH 2/2] Reduce verbosity of node table logging. --- libp2p/NodeTable.cpp | 18 +++++++++--------- libp2p/NodeTable.h | 5 ++++- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/libp2p/NodeTable.cpp b/libp2p/NodeTable.cpp index adeb43c2e..08bb0624a 100644 --- a/libp2p/NodeTable.cpp +++ b/libp2p/NodeTable.cpp @@ -97,7 +97,7 @@ shared_ptr NodeTable::addNode(Node const& _node) m_socketPointer->send(p); // TODO p2p: rename to p2p.nodes.pending, add p2p.nodes.add event (when pong is received) - clog(NodeTableNote) << "p2p.nodes.add " << _node.id.abridged(); + clog(NodeTableUpdate) << "p2p.nodes.add " << _node.id.abridged(); if (m_nodeEventHandler) m_nodeEventHandler->appendEvent(_node.id, NodeEntryAdded); @@ -159,7 +159,7 @@ void NodeTable::discover(NodeId _node, unsigned _round, shared_ptr node(addNode(_pubk, _endpoint, bi::tcp::endpoint(_endpoint.address(), _endpoint.port()))); @@ -361,7 +361,7 @@ void NodeTable::dropNode(shared_ptr _n) m_nodes.erase(_n->id); } - clog(NodeTableNote) << "p2p.nodes.drop " << _n->id.abridged(); + clog(NodeTableUpdate) << "p2p.nodes.drop " << _n->id.abridged(); if (m_nodeEventHandler) m_nodeEventHandler->appendEvent(_n->id, NodeEntryRemoved); } @@ -376,7 +376,7 @@ void NodeTable::onReceived(UDPSocketFace*, bi::udp::endpoint const& _from, bytes // h256 + Signature + type + RLP (smallest possible packet is empty neighbours packet which is 3 bytes) if (_packet.size() < h256::size + Signature::size + 1 + 3) { - clog(NodeTableMessageSummary) << "Invalid Message size from " << _from.address().to_string() << ":" << _from.port(); + clog(NodeTableWarn) << "Invalid Message size from " << _from.address().to_string() << ":" << _from.port(); return; } @@ -384,7 +384,7 @@ void NodeTable::onReceived(UDPSocketFace*, bi::udp::endpoint const& _from, bytes h256 hashSigned(sha3(hashedBytes)); if (!_packet.cropped(0, h256::size).contentsEqual(hashSigned.asBytes())) { - clog(NodeTableMessageSummary) << "Invalid Message hash from " << _from.address().to_string() << ":" << _from.port(); + clog(NodeTableWarn) << "Invalid Message hash from " << _from.address().to_string() << ":" << _from.port(); return; } @@ -396,7 +396,7 @@ void NodeTable::onReceived(UDPSocketFace*, bi::udp::endpoint const& _from, bytes Public nodeid(dev::recover(*(Signature const*)sigBytes.data(), sha3(signedBytes))); if (!nodeid) { - clog(NodeTableMessageSummary) << "Invalid Message signature from " << _from.address().to_string() << ":" << _from.port(); + clog(NodeTableWarn) << "Invalid Message signature from " << _from.address().to_string() << ":" << _from.port(); return; } @@ -516,7 +516,7 @@ void NodeTable::doRefreshBuckets(boost::system::error_code const& _ec) if (_ec) return; - clog(NodeTableNote) << "refreshing buckets"; + clog(NodeTableEvent) << "refreshing buckets"; bool connected = m_socketPointer->isOpen(); bool refreshed = false; if (connected) diff --git a/libp2p/NodeTable.h b/libp2p/NodeTable.h index 10fa921e4..9717b77a3 100644 --- a/libp2p/NodeTable.h +++ b/libp2p/NodeTable.h @@ -411,8 +411,11 @@ struct Neighbours: RLPXDatagram struct NodeTableWarn: public LogChannel { static const char* name() { return "!P!"; } static const int verbosity = 0; }; struct NodeTableNote: public LogChannel { static const char* name() { return "*P*"; } static const int verbosity = 1; }; struct NodeTableMessageSummary: public LogChannel { static const char* name() { return "-P-"; } static const int verbosity = 2; }; -struct NodeTableConnect: public LogChannel { static const char* name() { return "+P+"; } static const int verbosity = 10; }; struct NodeTableMessageDetail: public LogChannel { static const char* name() { return "=P="; } static const int verbosity = 5; }; +struct NodeTableConnect: public LogChannel { static const char* name() { return "+P+"; } static const int verbosity = 10; }; +struct NodeTableEvent: public LogChannel { static const char* name() { return "+P+"; } static const int verbosity = 10; }; +struct NodeTableTimer: public LogChannel { static const char* name() { return "+P+"; } static const int verbosity = 10; }; +struct NodeTableUpdate: public LogChannel { static const char* name() { return "+P+"; } static const int verbosity = 10; }; struct NodeTableTriviaSummary: public LogChannel { static const char* name() { return "-P-"; } static const int verbosity = 10; }; struct NodeTableTriviaDetail: public LogChannel { static const char* name() { return "=P="; } static const int verbosity = 11; }; struct NodeTableAllDetail: public LogChannel { static const char* name() { return "=P="; } static const int verbosity = 13; };