rippled
Loading...
Searching...
No Matches
LegacyPathFind.cpp
1#include <xrpld/app/main/Application.h>
2#include <xrpld/app/misc/LoadFeeTrack.h>
3#include <xrpld/core/Job.h>
4#include <xrpld/core/JobQueue.h>
5#include <xrpld/rpc/detail/LegacyPathFind.h>
6#include <xrpld/rpc/detail/Tuning.h>
7
8namespace ripple {
9namespace RPC {
10
12{
13 if (isAdmin)
14 {
15 ++inProgress;
16 m_isOk = true;
17 return;
18 }
19
20 auto const& jobCount = app.getJobQueue().getJobCountGE(jtCLIENT);
21 if (jobCount > Tuning::maxPathfindJobCount ||
23 return;
24
25 while (true)
26 {
27 int prevVal = inProgress.load();
28 if (prevVal >= Tuning::maxPathfindsInProgress)
29 return;
30
32 prevVal,
33 prevVal + 1,
36 {
37 m_isOk = true;
38 return;
39 }
40 }
41}
42
48
50
51} // namespace RPC
52} // namespace ripple
virtual LoadFeeTrack & getFeeTrack()=0
virtual JobQueue & getJobQueue()=0
int getJobCountGE(JobType t) const
All waiting jobs at or greater than this priority.
Definition JobQueue.cpp:143
bool isLoadedLocal() const
static std::atomic< int > inProgress
LegacyPathFind(bool isAdmin, Application &app)
T compare_exchange_strong(T... args)
T is_same_v
T load(T... args)
static int constexpr maxPathfindJobCount
static int constexpr maxPathfindsInProgress
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
bool isAdmin(Port const &port, Json::Value const &params, beast::IP::Address const &remoteIp)
Definition Role.cpp:66
@ jtCLIENT
Definition Job.h:26