mirror of
https://github.com/monero-project/monero.git
synced 2024-11-18 00:37:43 +00:00
p2p: warn when no incoming connections are seen for a while
This commit is contained in:
parent
a2cef8cba4
commit
de1ffe07b1
2 changed files with 16 additions and 0 deletions
|
@ -244,6 +244,7 @@ namespace nodetool
|
||||||
|
|
||||||
bool check_connection_and_handshake_with_peer(const epee::net_utils::network_address& na, uint64_t last_seen_stamp);
|
bool check_connection_and_handshake_with_peer(const epee::net_utils::network_address& na, uint64_t last_seen_stamp);
|
||||||
bool gray_peerlist_housekeeping();
|
bool gray_peerlist_housekeeping();
|
||||||
|
bool check_incoming_connections();
|
||||||
|
|
||||||
void kill() { ///< will be called e.g. from deinit()
|
void kill() { ///< will be called e.g. from deinit()
|
||||||
_info("Killing the net_node");
|
_info("Killing the net_node");
|
||||||
|
@ -307,6 +308,7 @@ namespace nodetool
|
||||||
epee::math_helper::once_a_time_seconds<1> m_connections_maker_interval;
|
epee::math_helper::once_a_time_seconds<1> m_connections_maker_interval;
|
||||||
epee::math_helper::once_a_time_seconds<60*30, false> m_peerlist_store_interval;
|
epee::math_helper::once_a_time_seconds<60*30, false> m_peerlist_store_interval;
|
||||||
epee::math_helper::once_a_time_seconds<60> m_gray_peerlist_housekeeping_interval;
|
epee::math_helper::once_a_time_seconds<60> m_gray_peerlist_housekeeping_interval;
|
||||||
|
epee::math_helper::once_a_time_seconds<900, false> m_incoming_connections_interval;
|
||||||
|
|
||||||
std::string m_bind_ip;
|
std::string m_bind_ip;
|
||||||
std::string m_port;
|
std::string m_port;
|
||||||
|
|
|
@ -1293,6 +1293,20 @@ namespace nodetool
|
||||||
m_connections_maker_interval.do_call(boost::bind(&node_server<t_payload_net_handler>::connections_maker, this));
|
m_connections_maker_interval.do_call(boost::bind(&node_server<t_payload_net_handler>::connections_maker, this));
|
||||||
m_gray_peerlist_housekeeping_interval.do_call(boost::bind(&node_server<t_payload_net_handler>::gray_peerlist_housekeeping, this));
|
m_gray_peerlist_housekeeping_interval.do_call(boost::bind(&node_server<t_payload_net_handler>::gray_peerlist_housekeeping, this));
|
||||||
m_peerlist_store_interval.do_call(boost::bind(&node_server<t_payload_net_handler>::store_config, this));
|
m_peerlist_store_interval.do_call(boost::bind(&node_server<t_payload_net_handler>::store_config, this));
|
||||||
|
m_incoming_connections_interval.do_call(boost::bind(&node_server<t_payload_net_handler>::check_incoming_connections, this));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
//-----------------------------------------------------------------------------------
|
||||||
|
template<class t_payload_net_handler>
|
||||||
|
bool node_server<t_payload_net_handler>::check_incoming_connections()
|
||||||
|
{
|
||||||
|
if (m_offline || m_hide_my_port)
|
||||||
|
return true;
|
||||||
|
if (get_incoming_connections_count() == 0)
|
||||||
|
{
|
||||||
|
const el::Level level = el::Level::Warning;
|
||||||
|
MCLOG_RED(level, "global", "No incoming connections - check firewalls/routers allow port " << get_this_peer_port());
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue