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; | ||||
} | } | ||||
void PeerManager::getPeers(std::vector<Peer> &vpeers) const { | |||||
for (auto &it : peers.get<0>()) { | |||||
vpeers.emplace_back(it); | |||||
} | |||||
} | |||||
void PeerManager::getNodeIdsForPeer(PeerId peerId, | |||||
std::vector<NodeId> &nodeids) const { | |||||
auto r = nodes.get<2>().equal_range(peerId); | |||||
for (auto it = r.first; it != r.second; ++it) { | |||||
nodeids.emplace_back(it->nodeid); | |||||
} | |||||
} | |||||
} // namespace avalanche | } // namespace avalanche |