Skip to content

Commit

Permalink
debug logs: add peer group to peerlist
Browse files Browse the repository at this point in the history
  • Loading branch information
Malinero committed Sep 18, 2022
1 parent 3856e23 commit c7d5f1b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/p2p/net_node.inl
Original file line number Diff line number Diff line change
Expand Up @@ -2147,7 +2147,7 @@ namespace nodetool
}

LOG_DEBUG_CC(context, "REMOTE PEERLIST: remote peerlist size=" << peerlist_.size());
LOG_TRACE_CC(context, "REMOTE PEERLIST: " << ENDL << print_peerlist_to_string(peerlist_));
LOG_TRACE_CC(context, "REMOTE PEERLIST: " << ENDL << print_peerlist_to_string(peerlist_, m_asmap));
CRITICAL_REGION_LOCAL(m_blocked_hosts_lock);
return m_network_zones.at(context.m_remote_address.get_zone()).m_peerlist.merge_peerlist(peerlist_, [this](const peerlist_entry &pe) {
return !is_addr_recently_failed(pe.adr) && is_remote_host_allowed(pe.adr);
Expand Down Expand Up @@ -2596,7 +2596,7 @@ namespace nodetool
std::vector<peerlist_entry> pl_gray;
for (auto& zone : m_network_zones)
zone.second.m_peerlist.get_peerlist(pl_gray, pl_white);
MINFO(ENDL << "Peerlist white:" << ENDL << print_peerlist_to_string(pl_white) << ENDL << "Peerlist gray:" << ENDL << print_peerlist_to_string(pl_gray) );
MINFO(ENDL << "Peerlist white:" << ENDL << print_peerlist_to_string(pl_white, m_asmap) << ENDL << "Peerlist gray:" << ENDL << print_peerlist_to_string(pl_gray, m_asmap) );
return true;
}
//-----------------------------------------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion src/p2p/p2p_protocol_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "net/net_utils_base.h"
#include "net/tor_address.h" // needed for serialization
#include "net/i2p_address.h" // needed for serialization
#include "net/group.h"
#include "misc_language.h"
#include "string_tools.h"
#include "time_helper.h"
Expand Down Expand Up @@ -143,7 +144,7 @@ namespace nodetool
#pragma pack(pop)

inline
std::string print_peerlist_to_string(const std::vector<peerlist_entry>& pl)
std::string print_peerlist_to_string(const std::vector<peerlist_entry>& pl, const std::vector<bool> &asmap)
{
time_t now_time = 0;
time(&now_time);
Expand All @@ -156,6 +157,7 @@ namespace nodetool
<< " \trpc credits per hash " << (pe.rpc_credits_per_hash > 0 ? std::to_string(pe.rpc_credits_per_hash) : "-")
<< " \tpruning seed " << pe.pruning_seed
<< " \tlast_seen: " << (pe.last_seen == 0 ? std::string("never") : epee::misc_utils::get_time_interval_string(now_time - pe.last_seen))
<< " \tbucket: " << net::group::get_group(pe.adr, asmap)
<< std::endl;
}
return ss.str();
Expand Down

0 comments on commit c7d5f1b

Please sign in to comment.