29 Sp<Node> getNode(
const InfoHash&
id, sa_family_t family);
30 Sp<Node> getNode(
const InfoHash&
id,
const SockAddr&, time_point now,
bool confirmed,
bool client=
false);
31 std::vector<Sp<Node>> getCachedNodes(
const InfoHash&
id, sa_family_t sa_f,
size_t count)
const;
43 class NodeMap :
private std::map<InfoHash, std::weak_ptr<Node>> {
45 Sp<Node> getNode(
const InfoHash&
id);
46 Sp<Node> getNode(
const InfoHash&
id,
const SockAddr&, time_point now,
bool confirmed,
bool client);
47 std::vector<Sp<Node>> getCachedNodes(
const InfoHash&
id,
size_t count)
const;
52 size_t cleanup_counter {0};
55 const NodeMap& cache(sa_family_t af)
const {
return af == AF_INET ? cache_4 : cache_6; }
56 NodeMap& cache(sa_family_t af) {
return af == AF_INET ? cache_4 : cache_6; }
void clearBadNodes(sa_family_t family=0)