20 #include <ripple/overlay/PeerSet.h>
21 #include <ripple/app/main/Application.h>
22 #include <ripple/core/JobQueue.h>
23 #include <ripple/overlay/Overlay.h>
27 using namespace std::chrono_literals;
45 , mTimerInterval (interval)
50 , mTimer (app_.getIOService ())
62 if (!
mPeers.insert (ptr->id ()).second)
73 [wptr=
pmDowncast()](boost::system::error_code
const& ec)
75 if (ec == boost::asio::error::operation_aborted)
78 if (
auto ptr = wptr.lock ())
94 <<
") pc=" <<
mPeers.size () <<
" acquiring " <<
mHash;
118 peer->send (std::make_shared<Message> (tmGL, protocol::mtGET_LEDGER));
128 auto packet = std::make_shared<Message>(tmGL, protocol::mtGET_LEDGER);
virtual void onTimer(bool progress, ScopedLockType &)=0
std::size_t getPeerCount() const
boost::asio::basic_waitable_timer< std::chrono::steady_clock > mTimer
std::set< Peer::id_t > mPeers
virtual bool isDone() const
virtual void newPeer(std::shared_ptr< Peer > const &)=0
bool insert(std::shared_ptr< Peer > const &)
Insert a peer to the managed set.
virtual time_point now() const =0
Returns the current time.
A generic endpoint for log messages.
PeerSet(Application &app, uint256 const &hash, std::chrono::milliseconds interval, clock_type &clock, beast::Journal journal)
void sendRequest(const protocol::TMGetLedger &message)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
virtual Overlay & overlay()=0
std::chrono::milliseconds mTimerInterval
clock_type::time_point mLastAction
virtual std::weak_ptr< PeerSet > pmDowncast()=0
virtual std::shared_ptr< Peer > findPeerByShortID(Peer::id_t const &id)=0
Returns the peer with the matching short id, or null.
std::recursive_mutex mLock