mirror of
https://github.com/monero-project/monero.git
synced 2025-08-16 21:30:24 -04:00
Don't exclusively drop tor/i2p outgoing cxns in idle loop
This commit is contained in:
parent
8349cfe4a6
commit
2dab31f62f
4 changed files with 65 additions and 29 deletions
|
@ -113,12 +113,23 @@ namespace cryptonote
|
|||
const block_queue &get_block_queue() const { return m_block_queue; }
|
||||
void stop();
|
||||
void on_connection_close(cryptonote_connection_context &context);
|
||||
void set_max_out_peers(unsigned int max) { m_max_out_peers = max; }
|
||||
void set_max_out_peers(epee::net_utils::zone zone, unsigned int max) { CRITICAL_REGION_LOCAL(m_max_out_peers_lock); m_max_out_peers[zone] = max; }
|
||||
unsigned int get_max_out_peers(epee::net_utils::zone zone) const
|
||||
{
|
||||
CRITICAL_REGION_LOCAL(m_max_out_peers_lock);
|
||||
const auto it = m_max_out_peers.find(zone);
|
||||
if (it == m_max_out_peers.end())
|
||||
{
|
||||
MWARNING(epee::net_utils::zone_to_string(zone) << " max out peers not set, using default");
|
||||
return P2P_DEFAULT_CONNECTIONS_COUNT;
|
||||
}
|
||||
return it->second;
|
||||
}
|
||||
bool no_sync() const { return m_no_sync; }
|
||||
void set_no_sync(bool value) { m_no_sync = value; }
|
||||
std::string get_peers_overview() const;
|
||||
std::pair<uint32_t, uint32_t> get_next_needed_pruning_stripe() const;
|
||||
bool needs_new_sync_connections() const;
|
||||
bool needs_new_sync_connections(epee::net_utils::zone zone) const;
|
||||
bool is_busy_syncing();
|
||||
|
||||
private:
|
||||
|
@ -171,7 +182,8 @@ namespace cryptonote
|
|||
epee::math_helper::once_a_time_milliseconds<100> m_standby_checker;
|
||||
epee::math_helper::once_a_time_seconds<101> m_sync_search_checker;
|
||||
epee::math_helper::once_a_time_seconds<43> m_bad_peer_checker;
|
||||
std::atomic<unsigned int> m_max_out_peers;
|
||||
std::unordered_map<epee::net_utils::zone, unsigned int> m_max_out_peers;
|
||||
mutable epee::critical_section m_max_out_peers_lock;
|
||||
tools::PerformanceTimer m_sync_timer, m_add_timer;
|
||||
uint64_t m_last_add_end_time;
|
||||
uint64_t m_sync_spans_downloaded, m_sync_old_spans_downloaded, m_sync_bad_spans_downloaded;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue