From cfea250787e34f7af0e9c54e5f6145e5e1082dfe Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 4 Feb 2015 17:48:12 -0800 Subject: [PATCH] Avoid pulling in unnecessary stuff. Avoid over-warning. --- libdevcore/CMakeLists.txt | 3 +-- libp2p/Capability.cpp | 2 +- libp2p/Session.cpp | 17 +++++++++++------ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/libdevcore/CMakeLists.txt b/libdevcore/CMakeLists.txt index df93361a4..51caee3d3 100644 --- a/libdevcore/CMakeLists.txt +++ b/libdevcore/CMakeLists.txt @@ -26,9 +26,8 @@ else() endif() target_link_libraries(${EXECUTABLE} ${Boost_THREAD_LIBRARIES}) -target_link_libraries(${EXECUTABLE} ${Boost_DATE_TIME_LIBRARIES}) +#target_link_libraries(${EXECUTABLE} ${Boost_DATE_TIME_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${Boost_SYSTEM_LIBRARIES}) -target_link_libraries(${EXECUTABLE} ${Boost_CHRONO_LIBRARIES}) if (APPLE) find_package(Threads REQUIRED) diff --git a/libp2p/Capability.cpp b/libp2p/Capability.cpp index dfa1ab546..5ef70bbc3 100644 --- a/libp2p/Capability.cpp +++ b/libp2p/Capability.cpp @@ -39,7 +39,7 @@ Capability::Capability(Session* _s, HostCapabilityFace* _h, unsigned _idOffset): void Capability::disable(std::string const& _problem) { - clogS(NetConnect) << "Disabling capability '" << m_host->name() << "'. Reason:" << _problem; + clogS(NetWarn) << "DISABLE: Disabling capability '" << m_host->name() << "'. Reason:" << _problem; m_enabled = false; } diff --git a/libp2p/Session.cpp b/libp2p/Session.cpp index dc9c50af5..d4342c37a 100644 --- a/libp2p/Session.cpp +++ b/libp2p/Session.cpp @@ -273,24 +273,24 @@ bool Session::interpret(RLP const& _r) } case PingPacket: { - clogS(NetTriviaSummary) << "Ping"; + clogS(NetTriviaSummary) << "Ping"; RLPStream s; sealAndSend(prep(s, PongPacket)); break; } case PongPacket: m_info.lastPing = std::chrono::steady_clock::now() - m_ping; - clogS(NetTriviaSummary) << "Latency: " << chrono::duration_cast(m_info.lastPing).count() << " ms"; + clogS(NetTriviaSummary) << "Latency: " << chrono::duration_cast(m_info.lastPing).count() << " ms"; break; case GetPeersPacket: { - clogS(NetTriviaSummary) << "GetPeers"; + clogS(NetTriviaSummary) << "GetPeers"; m_theyRequestedNodes = true; serviceNodesRequest(); break; } case PeersPacket: - clogS(NetTriviaSummary) << "Peers (" << dec << (_r.itemCount() - 1) << " entries)"; + clogS(NetTriviaSummary) << "Peers (" << dec << (_r.itemCount() - 1) << " entries)"; m_weRequestedNodes = false; for (unsigned i = 1; i < _r.itemCount(); ++i) { @@ -369,8 +369,13 @@ bool Session::interpret(RLP const& _r) { auto id = _r[0].toInt(); for (auto const& i: m_capabilities) - if (i.second->m_enabled && id >= i.second->m_idOffset && id - i.second->m_idOffset < i.second->hostCapability()->messageCount() && i.second->interpret(id - i.second->m_idOffset, _r)) - return true; + if (id >= i.second->m_idOffset && id - i.second->m_idOffset < i.second->hostCapability()->messageCount()) + { + if (i.second->m_enabled) + return i.second->interpret(id - i.second->m_idOffset, _r); + else + return true; + } return false; } }