Cleanup the 'PeerSet' hierarchy:

This commit introduces no functional changes but cleans up the
code and shrinks the surface area by removing dead and unused
code, leveraging std:: alternatives to hand-rolled code and
improving comments and documentation.
This commit is contained in:
John Freeman
2020-04-23 15:06:52 -05:00
committed by Nik Bougalis
parent d025f3fb28
commit 5b5226d518
25 changed files with 358 additions and 571 deletions

View File

@@ -96,7 +96,7 @@ private:
boost::asio::io_service& io_service_;
boost::optional<boost::asio::io_service::work> work_;
boost::asio::io_service::strand strand_;
std::recursive_mutex mutex_; // VFALCO use std::mutex
mutable std::recursive_mutex mutex_; // VFALCO use std::mutex
std::condition_variable_any cond_;
std::weak_ptr<Timer> timer_;
boost::container::flat_map<Child*, std::weak_ptr<Child>> list_;
@@ -181,13 +181,13 @@ public:
limit() override;
std::size_t
size() override;
size() const override;
Json::Value
json() override;
PeerSequence
getActivePeers() override;
getActivePeers() const override;
void
check() override;
@@ -240,7 +240,7 @@ public:
//
template <class UnaryFunc>
void
for_each(UnaryFunc&& f)
for_each(UnaryFunc&& f) const
{
std::vector<std::weak_ptr<PeerImp>> wp;
{
@@ -261,12 +261,6 @@ public:
}
}
std::size_t
selectPeers(
PeerSet& set,
std::size_t limit,
std::function<bool(std::shared_ptr<Peer> const&)> score) override;
// Called when TMManifests is received from a peer
void
onManifests(