mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-23 07:58:52 +00:00
p2p: fix set_peer_just_seen ignoring last_seen
This commit is contained in:
parent
a1eca8ca7e
commit
aa3e89a2ba
@ -110,7 +110,7 @@ namespace nodetool
|
|||||||
bool get_gray_peer_by_index(peerlist_entry& p, size_t i);
|
bool get_gray_peer_by_index(peerlist_entry& p, size_t i);
|
||||||
template<typename F> bool foreach(bool white, const F &f);
|
template<typename F> bool foreach(bool white, const F &f);
|
||||||
void evict_host_from_white_peerlist(const peerlist_entry& pr);
|
void evict_host_from_white_peerlist(const peerlist_entry& pr);
|
||||||
bool append_with_peer_white(const peerlist_entry& pr);
|
bool append_with_peer_white(const peerlist_entry& pr, bool trust_last_seen = false);
|
||||||
bool append_with_peer_gray(const peerlist_entry& pr);
|
bool append_with_peer_gray(const peerlist_entry& pr);
|
||||||
bool append_with_peer_anchor(const anchor_peerlist_entry& ple);
|
bool append_with_peer_anchor(const anchor_peerlist_entry& ple);
|
||||||
bool set_peer_just_seen(peerid_type peer, const epee::net_utils::network_address& addr, uint32_t pruning_seed, uint16_t rpc_port, uint32_t rpc_credits_per_hash);
|
bool set_peer_just_seen(peerid_type peer, const epee::net_utils::network_address& addr, uint32_t pruning_seed, uint16_t rpc_port, uint32_t rpc_credits_per_hash);
|
||||||
@ -329,12 +329,12 @@ namespace nodetool
|
|||||||
ple.pruning_seed = pruning_seed;
|
ple.pruning_seed = pruning_seed;
|
||||||
ple.rpc_port = rpc_port;
|
ple.rpc_port = rpc_port;
|
||||||
ple.rpc_credits_per_hash = rpc_credits_per_hash;
|
ple.rpc_credits_per_hash = rpc_credits_per_hash;
|
||||||
return append_with_peer_white(ple);
|
return append_with_peer_white(ple, true);
|
||||||
CATCH_ENTRY_L0("peerlist_manager::set_peer_just_seen()", false);
|
CATCH_ENTRY_L0("peerlist_manager::set_peer_just_seen()", false);
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
inline
|
inline
|
||||||
bool peerlist_manager::append_with_peer_white(const peerlist_entry& ple)
|
bool peerlist_manager::append_with_peer_white(const peerlist_entry& ple, bool trust_last_seen)
|
||||||
{
|
{
|
||||||
TRY_ENTRY();
|
TRY_ENTRY();
|
||||||
if(!is_host_allowed(ple.adr))
|
if(!is_host_allowed(ple.adr))
|
||||||
@ -357,7 +357,8 @@ namespace nodetool
|
|||||||
new_ple.pruning_seed = by_addr_it_wt->pruning_seed;
|
new_ple.pruning_seed = by_addr_it_wt->pruning_seed;
|
||||||
if (by_addr_it_wt->rpc_port && ple.rpc_port == 0) // guard against older nodes not passing RPC port around
|
if (by_addr_it_wt->rpc_port && ple.rpc_port == 0) // guard against older nodes not passing RPC port around
|
||||||
new_ple.rpc_port = by_addr_it_wt->rpc_port;
|
new_ple.rpc_port = by_addr_it_wt->rpc_port;
|
||||||
new_ple.last_seen = by_addr_it_wt->last_seen; // do not overwrite the last seen timestamp, incoming peer list are untrusted
|
if (!trust_last_seen)
|
||||||
|
new_ple.last_seen = by_addr_it_wt->last_seen; // do not overwrite the last seen timestamp, incoming peer lists are untrusted
|
||||||
m_peers_white.replace(by_addr_it_wt, new_ple);
|
m_peers_white.replace(by_addr_it_wt, new_ple);
|
||||||
}
|
}
|
||||||
//remove from gray list, if need
|
//remove from gray list, if need
|
||||||
|
Loading…
Reference in New Issue
Block a user