diff --git a/libdevcore/StructuredLogger.cpp b/libdevcore/StructuredLogger.cpp index 458f3dc79..8188b0d04 100644 --- a/libdevcore/StructuredLogger.cpp +++ b/libdevcore/StructuredLogger.cpp @@ -80,7 +80,7 @@ void StructuredLogger::logP2PConnected(string const& _id, bi::tcp::endpoint cons } } -void StructuredLogger::logP2PDisconnected(string const& _id, unsigned int _numConnections, bi::tcp::endpoint const& _addr) const +void StructuredLogger::logP2PDisconnected(string const& _id, bi::tcp::endpoint const& _addr, unsigned int _numConnections) const { if (m_enabled) { diff --git a/libdevcore/StructuredLogger.h b/libdevcore/StructuredLogger.h index de838da6f..b3a71430f 100644 --- a/libdevcore/StructuredLogger.h +++ b/libdevcore/StructuredLogger.h @@ -41,7 +41,7 @@ public: void logStarting(std::string const& _clientImpl, const char* _ethVersion); void logP2PConnected(std::string const& _id, bi::tcp::endpoint const& _addr, std::chrono::system_clock::time_point const& _ts, unsigned int _numConnections) const; - void logP2PDisconnected(std::string const& _id, unsigned int _numConnections, bi::tcp::endpoint const& _addr) const; + void logP2PDisconnected(std::string const& _id, bi::tcp::endpoint const& _addr, unsigned int _numConnections) const; void logMinedNewBlock(std::string const& _hash, std::string const& _blockNumber, std::string const& _chainHeadHash, std::string const& _prevHash) const; void logChainReceivedNewBlock(std::string const& _hash, std::string const& _blockNumber, std::string const& _chainHeadHash, diff --git a/libethereum/BlockChain.h b/libethereum/BlockChain.h index ffdbccee4..6d36b14cd 100644 --- a/libethereum/BlockChain.h +++ b/libethereum/BlockChain.h @@ -97,7 +97,7 @@ public: BlockInfo info(h256 _hash) const { return BlockInfo(block(_hash)); } BlockInfo info() const { return BlockInfo(block()); } - /// Get the familial details concerning a block (or the most recent mined if none given). Thread-safe. + /// Get the familiar details concerning a block (or the most recent mined if none given). Thread-safe. BlockDetails details(h256 _hash) const { return queryExtras(_hash, m_details, x_details, NullBlockDetails); } BlockDetails details() const { return details(currentHash()); } diff --git a/libp2p/Host.cpp b/libp2p/Host.cpp index 9c73f0173..5b35f4ca7 100644 --- a/libp2p/Host.cpp +++ b/libp2p/Host.cpp @@ -159,6 +159,10 @@ void Host::registerPeer(std::shared_ptr _s, CapDescs const& _caps) { { clog(NetNote) << "p2p.host.peer.register" << _s->m_peer->id.abridged(); + m_structuredLogger.logP2PConnected( + _s->m_peer->id.abridged(), _s->m_peer->peerEndpoint(), + _s->m_peer->m_lastConnected, + 0);// TODO: num_connections RecursiveGuard l(x_sessions); // TODO: temporary loose-coupling; if m_peers already has peer, // it is same as _s->m_peer. (fixing next PR) @@ -476,9 +480,6 @@ void Host::connect(std::shared_ptr const& _p) _p->m_lastConnected = std::chrono::system_clock::now(); _p->m_failedAttempts = 0; - m_structuredLogger.logP2PConnected(_p->id.abridged(), _p->peerEndpoint(), _p->m_lastConnected, - 0);// TODO: num_connections - auto ps = make_shared(this, std::move(*s), _p); ps->start(); diff --git a/libp2p/Session.cpp b/libp2p/Session.cpp index 6ff765cf6..78caa6273 100644 --- a/libp2p/Session.cpp +++ b/libp2p/Session.cpp @@ -467,6 +467,8 @@ void Session::drop(DisconnectReason _reason) void Session::disconnect(DisconnectReason _reason) { clogS(NetConnect) << "Disconnecting (our reason:" << reasonOf(_reason) << ")"; + m_server->m_structuredLogger.logP2PDisconnected(m_info.id.abridged(), m_peer->peerEndpoint(), + 0);// TODO: num connections if (m_socket.is_open()) { RLPStream s;