예제 #1
0
 /** Close all peer connections.
     If `graceful` is true then active 
     Requirements:
         Caller must hold the mutex.
 */
 void close_all (bool graceful)
 {
     for (auto const& entry : m_peers)
     {
         PeerImp::ptr const peer (entry.second.lock());
         assert (peer != nullptr);
         peer->close (graceful);
     }
 }
예제 #2
0
/** Close all peer connections.
    If `graceful` is true then active
    Requirements:
        Caller must hold the mutex.
*/
void
OverlayImpl::close_all (bool graceful)
{
    for (auto const& entry : m_peers)
    {
        PeerImp::ptr const peer (entry.second.lock());

        // VFALCO The only case where the weak_ptr is expired should be if
        //        ~PeerImp is pre-empted before it calls m_peers.remove()
        //
        if (peer != nullptr)
            peer->close (graceful);
    }
}
예제 #3
0
    void disconnect (PeerFinder::Slot::ptr const& slot, bool graceful)
    {
        if (m_journal.trace) m_journal.trace <<
            "Disconnect " << slot->remote_endpoint () <<
            (graceful ? "gracefully" : "");

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

        PeersBySlot::iterator const iter (m_peers.find (slot));
        assert (iter != m_peers.end ());
        PeerImp::ptr const peer (iter->second.lock());
        assert (peer != nullptr);
        peer->close (graceful);
        //peer->detach ("disc", false);
    }