Example #1
0
Overlay::PeerSequence
OverlayImpl::getActivePeers ()
{
    Overlay::PeerSequence ret;

    std::lock_guard <decltype(m_mutex)> lock (m_mutex);

    ret.reserve (m_publicKeyMap.size ());

    BOOST_FOREACH (PeerByPublicKey::value_type const& pair, m_publicKeyMap)
    {
        assert (!!pair.second);
        ret.push_back (pair.second);
    }
Example #2
0
Overlay::PeerSequence
OverlayImpl::getActivePeers()
{
    Overlay::PeerSequence ret;
    std::lock_guard <decltype(mutex_)> lock (mutex_);
    ret.reserve (m_publicKeyMap.size ());
    for (auto const& e : m_publicKeyMap)
    {
        auto const sp = e.second.lock();
        if (sp)
            ret.push_back(sp);
    }

    return ret;
}