P2PServer: show an error when there are no connections

This commit is contained in:
SChernykh 2021-10-08 18:02:04 +02:00
parent af2a8eeb08
commit 77a3a5857c
3 changed files with 9 additions and 0 deletions

View File

@ -371,6 +371,7 @@ template<> struct log::Stream::Entry<XMRAmount>
template<> struct log::Stream::Entry<NetworkType> template<> struct log::Stream::Entry<NetworkType>
{ {
// cppcheck-suppress constParameter
static NOINLINE void put(const NetworkType& value, Stream* wrapper) static NOINLINE void put(const NetworkType& value, Stream* wrapper)
{ {
switch (value) { switch (value) {

View File

@ -49,6 +49,7 @@ P2PServer::P2PServer(p2pool* pool)
, m_rng(m_rd()) , m_rng(m_rd())
, m_block(new PoolBlock()) , m_block(new PoolBlock())
, m_timer{} , m_timer{}
, m_timerCounter(0)
, m_peerId(m_rng()) , m_peerId(m_rng())
, m_peerListLastSaved(0) , m_peerListLastSaved(0)
{ {
@ -227,6 +228,10 @@ void P2PServer::update_peer_connections()
} }
peer_list.pop_back(); 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() void P2PServer::update_peer_list()
@ -662,6 +667,8 @@ void P2PServer::print_status()
void P2PServer::on_timer() void P2PServer::on_timer()
{ {
++m_timerCounter;
if (!m_initialPeerList.empty()) { if (!m_initialPeerList.empty()) {
connect_to_peers(m_initialPeerList); connect_to_peers(m_initialPeerList);
m_initialPeerList.clear(); m_initialPeerList.clear();

View File

@ -156,6 +156,7 @@ private:
PoolBlock* m_block; PoolBlock* m_block;
uv_timer_t m_timer; uv_timer_t m_timer;
uint32_t m_timerCounter;
uint64_t m_peerId; uint64_t m_peerId;