From 77a3a5857c59b143925913261819c2e689209642 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Fri, 8 Oct 2021 18:02:04 +0200 Subject: [PATCH] P2PServer: show an error when there are no connections --- src/log.h | 1 + src/p2p_server.cpp | 7 +++++++ src/p2p_server.h | 1 + 3 files changed, 9 insertions(+) diff --git a/src/log.h b/src/log.h index c1b47e3..0fe1963 100644 --- a/src/log.h +++ b/src/log.h @@ -371,6 +371,7 @@ template<> struct log::Stream::Entry template<> struct log::Stream::Entry { + // cppcheck-suppress constParameter static NOINLINE void put(const NetworkType& value, Stream* wrapper) { switch (value) { diff --git a/src/p2p_server.cpp b/src/p2p_server.cpp index 6946c97..c81ce24 100644 --- a/src/p2p_server.cpp +++ b/src/p2p_server.cpp @@ -49,6 +49,7 @@ P2PServer::P2PServer(p2pool* pool) , m_rng(m_rd()) , m_block(new PoolBlock()) , m_timer{} + , m_timerCounter(0) , m_peerId(m_rng()) , m_peerListLastSaved(0) { @@ -227,6 +228,10 @@ void P2PServer::update_peer_connections() } peer_list.pop_back(); } + + if ((m_numConnections == 0) && ((m_timerCounter % 30) == 0)) { + LOGERR(1, "no connections to other p2pool nodes, check your monerod/p2pool/network/firewall setup!!!"); + } } void P2PServer::update_peer_list() @@ -662,6 +667,8 @@ void P2PServer::print_status() void P2PServer::on_timer() { + ++m_timerCounter; + if (!m_initialPeerList.empty()) { connect_to_peers(m_initialPeerList); m_initialPeerList.clear(); diff --git a/src/p2p_server.h b/src/p2p_server.h index 2461216..5131381 100644 --- a/src/p2p_server.h +++ b/src/p2p_server.h @@ -156,6 +156,7 @@ private: PoolBlock* m_block; uv_timer_t m_timer; + uint32_t m_timerCounter; uint64_t m_peerId;