rippled
Loading...
Searching...
No Matches
LegacyPathFind.cpp
1#include <xrpld/app/main/Application.h>
2#include <xrpld/app/misc/LoadFeeTrack.h>
3#include <xrpld/rpc/detail/LegacyPathFind.h>
4#include <xrpld/rpc/detail/Tuning.h>
5
6#include <xrpl/core/Job.h>
7#include <xrpl/core/JobQueue.h>
8
9namespace xrpl {
10namespace RPC {
11
13{
14 if (isAdmin)
15 {
16 ++inProgress;
17 m_isOk = true;
18 return;
19 }
20
21 auto const& jobCount = app.getJobQueue().getJobCountGE(jtCLIENT);
22 if (jobCount > Tuning::maxPathfindJobCount ||
24 return;
25
26 while (true)
27 {
28 int prevVal = inProgress.load();
29 if (prevVal >= Tuning::maxPathfindsInProgress)
30 return;
31
33 prevVal,
34 prevVal + 1,
37 {
38 m_isOk = true;
39 return;
40 }
41 }
42}
43
49
51
52} // namespace RPC
53} // namespace xrpl
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:141
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:25