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);
23 return;
24
25 while (true)
26 {
27 int prevVal = inProgress.load();
28 if (prevVal >= Tuning::maxPathfindsInProgress)
29 return;
30
33 {
34 m_isOk = true;
35 return;
36 }
37 }
38}
39
45
47
48} // namespace RPC
49} // 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:126
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:63
@ jtCLIENT
Definition Job.h:25