p2p: lock access to the blocked ips map

This commit is contained in:
moneromooo-monero 2016-03-12 13:44:34 +00:00
parent dfd0e9c97d
commit 474e4c00f0
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
2 changed files with 3 additions and 3 deletions

View file

@ -120,7 +120,7 @@ namespace nodetool
void delete_connections(size_t count);
virtual bool block_ip(uint32_t adress, time_t seconds = P2P_IP_BLOCKTIME);
virtual bool unblock_ip(uint32_t address);
virtual std::map<uint32_t, time_t> get_blocked_ips() const { return m_blocked_ips; }
virtual std::map<uint32_t, time_t> get_blocked_ips() { CRITICAL_REGION_LOCAL(m_blocked_ips_lock); return m_blocked_ips; }
private:
const std::vector<std::string> m_seed_nodes_list =
{ "seeds.moneroseeds.se"

View file

@ -52,7 +52,7 @@ namespace nodetool
virtual void for_each_connection(std::function<bool(t_connection_context&, peerid_type)> f)=0;
virtual bool block_ip(uint32_t adress, time_t seconds = 0)=0;
virtual bool unblock_ip(uint32_t adress)=0;
virtual std::map<uint32_t, time_t> get_blocked_ips()const=0;
virtual std::map<uint32_t, time_t> get_blocked_ips()=0;
virtual bool add_ip_fail(uint32_t adress)=0;
};
@ -96,7 +96,7 @@ namespace nodetool
{
return true;
}
virtual std::map<uint32_t, time_t> get_blocked_ips() const
virtual std::map<uint32_t, time_t> get_blocked_ips()
{
return std::map<uint32_t, time_t>();
}