mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-28 06:55:50 +00:00
Replace boost locks and mutexes with std-equivalent
This commit is contained in:
@@ -26,6 +26,9 @@
|
||||
#include <boost/beast/core/detail/base64.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
#include <mutex>
|
||||
#include <shared_mutex>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
std::string
|
||||
@@ -82,7 +85,7 @@ ValidatorList::load (
|
||||
")?" // end optional comment block
|
||||
);
|
||||
|
||||
boost::unique_lock<boost::shared_mutex> read_lock{mutex_};
|
||||
std::unique_lock<std::shared_timed_mutex> read_lock{mutex_};
|
||||
|
||||
JLOG (j_.debug()) <<
|
||||
"Loading configured trusted validator list publisher keys";
|
||||
@@ -198,7 +201,7 @@ ValidatorList::applyList (
|
||||
if (version != requiredListVersion)
|
||||
return ListDisposition::unsupported_version;
|
||||
|
||||
boost::unique_lock<boost::shared_mutex> lock{mutex_};
|
||||
std::unique_lock<std::shared_timed_mutex> lock{mutex_};
|
||||
|
||||
Json::Value list;
|
||||
PublicKey pubKey;
|
||||
@@ -376,7 +379,7 @@ bool
|
||||
ValidatorList::listed (
|
||||
PublicKey const& identity) const
|
||||
{
|
||||
boost::shared_lock<boost::shared_mutex> read_lock{mutex_};
|
||||
std::shared_lock<std::shared_timed_mutex> read_lock{mutex_};
|
||||
|
||||
auto const pubKey = validatorManifests_.getMasterKey (identity);
|
||||
return keyListings_.find (pubKey) != keyListings_.end ();
|
||||
@@ -385,7 +388,7 @@ ValidatorList::listed (
|
||||
bool
|
||||
ValidatorList::trusted (PublicKey const& identity) const
|
||||
{
|
||||
boost::shared_lock<boost::shared_mutex> read_lock{mutex_};
|
||||
std::shared_lock<std::shared_timed_mutex> read_lock{mutex_};
|
||||
|
||||
auto const pubKey = validatorManifests_.getMasterKey (identity);
|
||||
return trustedKeys_.find (pubKey) != trustedKeys_.end();
|
||||
@@ -395,7 +398,7 @@ boost::optional<PublicKey>
|
||||
ValidatorList::getListedKey (
|
||||
PublicKey const& identity) const
|
||||
{
|
||||
boost::shared_lock<boost::shared_mutex> read_lock{mutex_};
|
||||
std::shared_lock<std::shared_timed_mutex> read_lock{mutex_};
|
||||
|
||||
auto const pubKey = validatorManifests_.getMasterKey (identity);
|
||||
if (keyListings_.find (pubKey) != keyListings_.end ())
|
||||
@@ -406,7 +409,7 @@ ValidatorList::getListedKey (
|
||||
boost::optional<PublicKey>
|
||||
ValidatorList::getTrustedKey (PublicKey const& identity) const
|
||||
{
|
||||
boost::shared_lock<boost::shared_mutex> read_lock{mutex_};
|
||||
std::shared_lock<std::shared_timed_mutex> read_lock{mutex_};
|
||||
|
||||
auto const pubKey = validatorManifests_.getMasterKey (identity);
|
||||
if (trustedKeys_.find (pubKey) != trustedKeys_.end())
|
||||
@@ -417,14 +420,14 @@ ValidatorList::getTrustedKey (PublicKey const& identity) const
|
||||
bool
|
||||
ValidatorList::trustedPublisher (PublicKey const& identity) const
|
||||
{
|
||||
boost::shared_lock<boost::shared_mutex> read_lock{mutex_};
|
||||
std::shared_lock<std::shared_timed_mutex> read_lock{mutex_};
|
||||
return identity.size() && publisherLists_.count (identity);
|
||||
}
|
||||
|
||||
PublicKey
|
||||
ValidatorList::localPublicKey () const
|
||||
{
|
||||
boost::shared_lock<boost::shared_mutex> read_lock{mutex_};
|
||||
std::shared_lock<std::shared_timed_mutex> read_lock{mutex_};
|
||||
return localPubKey_;
|
||||
}
|
||||
|
||||
@@ -459,7 +462,7 @@ ValidatorList::removePublisherList (PublicKey const& publisherKey)
|
||||
boost::optional<TimeKeeper::time_point>
|
||||
ValidatorList::expires() const
|
||||
{
|
||||
boost::shared_lock<boost::shared_mutex> read_lock{mutex_};
|
||||
std::shared_lock<std::shared_timed_mutex> read_lock{mutex_};
|
||||
boost::optional<TimeKeeper::time_point> res{boost::none};
|
||||
for (auto const& p : publisherLists_)
|
||||
{
|
||||
@@ -479,7 +482,7 @@ ValidatorList::getJson() const
|
||||
{
|
||||
Json::Value res(Json::objectValue);
|
||||
|
||||
boost::shared_lock<boost::shared_mutex> read_lock{mutex_};
|
||||
std::shared_lock<std::shared_timed_mutex> read_lock{mutex_};
|
||||
|
||||
res[jss::validation_quorum] = static_cast<Json::UInt>(quorum());
|
||||
|
||||
@@ -561,7 +564,7 @@ void
|
||||
ValidatorList::for_each_listed (
|
||||
std::function<void(PublicKey const&, bool)> func) const
|
||||
{
|
||||
boost::shared_lock<boost::shared_mutex> read_lock{mutex_};
|
||||
std::shared_lock<std::shared_timed_mutex> read_lock{mutex_};
|
||||
|
||||
for (auto const& v : keyListings_)
|
||||
func (v.first, trusted(v.first));
|
||||
@@ -629,7 +632,7 @@ ValidatorList::calculateQuorum (
|
||||
TrustChanges
|
||||
ValidatorList::updateTrusted(hash_set<NodeID> const& seenValidators)
|
||||
{
|
||||
boost::unique_lock<boost::shared_mutex> lock{mutex_};
|
||||
std::unique_lock<std::shared_timed_mutex> lock{mutex_};
|
||||
|
||||
// Remove any expired published lists
|
||||
for (auto const& list : publisherLists_)
|
||||
|
||||
Reference in New Issue
Block a user