예제 #1
0
void PeerSet::sendRequest (const protocol::TMGetLedger& tmGL, Peer::ptr const& peer)
{
    if (!peer)
        sendRequest (tmGL);
    else
        peer->send (std::make_shared<Message> (tmGL, protocol::mtGET_LEDGER));
}
예제 #2
0
void PeerSet::sendRequest (const protocol::TMGetLedger& tmGL)
{
    ScopedLockType sl (mLock);

    if (mPeers.empty ())
        return;

    Message::pointer packet (
        std::make_shared<Message> (tmGL, protocol::mtGET_LEDGER));

    for (auto const& p : mPeers)
    {
        Peer::ptr peer (app_.overlay ().findPeerByShortID (p.first));

        if (peer)
            peer->send (packet);
    }
}
예제 #3
0
bool PeerSet::insert (Peer::ptr const& ptr)
{
    ScopedLockType sl (mLock);

    if (!mPeers.insert (std::make_pair (ptr->id (), 0)).second)
        return false;

    newPeer (ptr);
    return true;
}
예제 #4
0
void PeerSet::badPeer (Peer::ptr const& ptr)
{
    ScopedLockType sl (mLock);
    mPeers.erase (ptr->getShortId ());
}
예제 #5
0
 void operator() (Peer::ptr const& peer)
 {
     json.append (peer->json ());
 }