Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/peermanager.cpp
Show First 20 Lines • Show All 432 Lines • ▼ Show 20 Lines | for (size_t i = begin; i < end; i++) { | ||||
return slots[i].getPeerId(); | return slots[i].getPeerId(); | ||||
} | } | ||||
} | } | ||||
// We failed to find a slot, retry. | // We failed to find a slot, retry. | ||||
return NO_PEER; | return NO_PEER; | ||||
} | } | ||||
std::vector<Peer> PeerManager::getPeers() const { | |||||
std::vector<Peer> vpeers; | |||||
for (auto &it : peers.get<0>()) { | |||||
vpeers.emplace_back(it); | |||||
} | |||||
return vpeers; | |||||
} | |||||
std::vector<NodeId> PeerManager::getNodeIdsForPeer(PeerId peerId) const { | |||||
std::vector<NodeId> nodeids; | |||||
auto &nview = nodes.get<next_request_time>(); | |||||
auto nodeRange = nview.equal_range(peerId); | |||||
for (auto it = nodeRange.first; it != nodeRange.second; ++it) { | |||||
nodeids.emplace_back(it->nodeid); | |||||
} | |||||
return nodeids; | |||||
} | |||||
} // namespace avalanche | } // namespace avalanche |