diff --git a/cmake/RippledCore.cmake b/cmake/RippledCore.cmake index 2e41531ba7..481b6e3cea 100644 --- a/cmake/RippledCore.cmake +++ b/cmake/RippledCore.cmake @@ -85,7 +85,6 @@ target_link_libraries(xrpl.libxrpl.basics PUBLIC xrpl.libxrpl.beast) add_module(xrpl json) target_link_libraries(xrpl.libxrpl.json PUBLIC xrpl.libxrpl.basics) - add_module(xrpl crypto) target_link_libraries(xrpl.libxrpl.crypto PUBLIC xrpl.libxrpl.basics) diff --git a/conanfile.py b/conanfile.py index e0373ac65e..3146b887e0 100644 --- a/conanfile.py +++ b/conanfile.py @@ -29,7 +29,7 @@ class Xrpl(ConanFile): 'nudb/2.0.9', 'openssl/1.1.1w', 'soci/4.0.3', - 'zlib/1.3.1' + 'zlib/1.3.1', ] test_requires = [ diff --git a/include/xrpl/beast/utility/Journal.h b/include/xrpl/beast/utility/Journal.h index 0e26164ece..0ea1f5e291 100644 --- a/include/xrpl/beast/utility/Journal.h +++ b/include/xrpl/beast/utility/Journal.h @@ -313,7 +313,7 @@ enum Severity { kNone = kDisabled }; -std::string +std::string_view to_string(Severity severity); } // namespace severities diff --git a/src/libxrpl/beast/utility/beast_Journal.cpp b/src/libxrpl/beast/utility/beast_Journal.cpp index 74a42fb34a..9c485cdfa8 100644 --- a/src/libxrpl/beast/utility/beast_Journal.cpp +++ b/src/libxrpl/beast/utility/beast_Journal.cpp @@ -94,29 +94,30 @@ Journal::getNullSink() //------------------------------------------------------------------------------ -std::string +std::string_view severities::to_string(Severity severity) { + using namespace std::string_view_literals; switch (severity) { case kDisabled: - return "disabled"; + return "disabled"sv; case kTrace: - return "trace"; + return "trace"sv; case kDebug: - return "debug"; + return "debug"sv; case kInfo: - return "info"; + return "info"sv; case kWarning: - return "warning"; + return "warning"sv; case kError: - return "error"; + return "error"sv; case kFatal: - return "fatal"; + return "fatal"sv; default: UNREACHABLE("Unexpected severity value!"); } - return ""; + return ""sv; } void diff --git a/src/test/core/Coroutine_test.cpp b/src/test/core/Coroutine_test.cpp index a3eb3c9440..8458da647d 100644 --- a/src/test/core/Coroutine_test.cpp +++ b/src/test/core/Coroutine_test.cpp @@ -175,74 +175,12 @@ public: BEAST_EXPECT(*lv == -1); } - void - test_yield_and_stop() - { - using namespace std::chrono_literals; - using namespace jtx; - - testcase("yield and stop"); - - Env env(*this, envconfig([](std::unique_ptr cfg) { - cfg->FORCE_MULTI_THREAD = true; - return cfg; - })); - - std::shared_ptr c; - std::mutex mutexStop; - std::mutex mutexYield; - std::condition_variable cond; - std::condition_variable condYield; - bool yielded = false; - bool stopped = false; - - env.app().getJobQueue().postCoro( - jtCLIENT, "Coroutine-Test", [&](auto const& cr) { - c = cr; - { - std::unique_lock lock(mutexYield); - yielded = true; - condYield.notify_all(); - } - c->yield(); - // Just to keep this job alive - std::this_thread::sleep_for(5ms); - }); - std::thread th{[&]() { - std::unique_lock lock(mutexStop); - cond.wait(lock, [&]() { return stopped; }); - // Delay a bit to wait for stop() to be called - std::this_thread::sleep_for(1ms); - c->post(); - }}; - - // Delay a bit to wait for yield() to be called - std::this_thread::sleep_for(1ms); - std::unique_lock lockYield(mutexYield); - condYield.wait(lockYield, [&]() { return yielded; }); - { - std::unique_lock lock(mutexStop); - stopped = true; - cond.notify_all(); - } - env.app().getJobQueue().stop(); - try - { - th.join(); - } - catch (std::exception const& e) - { - } - pass(); - } - void run() override { correct_order(); incorrect_order(); thread_specific_storage(); - // test_yield_and_stop(); } }; diff --git a/src/xrpld/core/ClosureCounter.h b/src/xrpld/core/ClosureCounter.h index ded056412a..92117a91c4 100644 --- a/src/xrpld/core/ClosureCounter.h +++ b/src/xrpld/core/ClosureCounter.h @@ -180,13 +180,6 @@ public: } } - template - Substitute - forceWrap(Closure&& closure) - { - return {*this, std::forward(closure)}; - } - /** Wrap the passed closure with a reference counter. @param closure Closure that accepts Args_t parameters and returns Ret_t. diff --git a/src/xrpld/core/Coro.ipp b/src/xrpld/core/Coro.ipp index 9abf4bbf81..5901e07c68 100644 --- a/src/xrpld/core/Coro.ipp +++ b/src/xrpld/core/Coro.ipp @@ -98,11 +98,6 @@ JobQueue::Coro::resume() } { std::lock_guard lock(jq_.m_mutex); - - XRPL_ASSERT( - jq_.nSuspend_ > 0, - "ripple::JobQueue::Coro::resume jq_.nSuspend_ should be greater " - "than 0"); --jq_.nSuspend_; } auto saved = detail::getLocalValues().release(); @@ -139,11 +134,6 @@ JobQueue::Coro::expectEarlyExit() // That said, since we're outside the Coro's stack, we need to // decrement the nSuspend that the Coro's call to yield caused. std::lock_guard lock(jq_.m_mutex); - - XRPL_ASSERT( - jq_.nSuspend_ > 0, - "ripple::JobQueue::Coro::expectEarlyExit() jq_.nSuspend_ should be " - "greater than 0"); --jq_.nSuspend_; #ifndef NDEBUG finished_ = true; diff --git a/src/xrpld/core/detail/JobQueue.cpp b/src/xrpld/core/detail/JobQueue.cpp index 986bb68545..1ea1df51ab 100644 --- a/src/xrpld/core/detail/JobQueue.cpp +++ b/src/xrpld/core/detail/JobQueue.cpp @@ -304,10 +304,9 @@ JobQueue::stop() // but there may still be some threads between the return of // `Job::doJob` and the return of `JobQueue::processTask`. That is why // we must wait on the condition variable to make these assertions. - std::unique_lock lock(m_mutex); - cv_.wait(lock, [this] { - return m_processCount == 0 && nSuspend_ == 0 && m_jobSet.empty(); - }); + std::unique_lock lock(m_mutex); + cv_.wait( + lock, [this] { return m_processCount == 0 && m_jobSet.empty(); }); XRPL_ASSERT( m_processCount == 0, "ripple::JobQueue::stop : all processes completed");