From 2aa8d2bdcc6f25ccd10ba95c6bddf77dcabecdfe Mon Sep 17 00:00:00 2001 From: SChernykh Date: Mon, 20 Jun 2022 22:37:33 +0200 Subject: [PATCH] Code cleanup --- src/p2pool_api.cpp | 2 +- src/p2pool_api.h | 4 ++-- src/pow_hash.cpp | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/p2pool_api.cpp b/src/p2pool_api.cpp index f5ea9c0..39fb9e9 100644 --- a/src/p2pool_api.cpp +++ b/src/p2pool_api.cpp @@ -101,7 +101,7 @@ void p2pool_api::on_stop() uv_close(reinterpret_cast(&m_dumpToFileAsync), nullptr); } -void p2pool_api::dump_to_file_async_internal(const Category& category, const char* filename, DumpFileCallbackBase&& callback) +void p2pool_api::dump_to_file_async_internal(Category category, const char* filename, DumpFileCallbackBase&& callback) { std::vector buf(16384); log::Stream s(buf.data(), buf.size()); diff --git a/src/p2pool_api.h b/src/p2pool_api.h index a0721d4..5a44213 100644 --- a/src/p2pool_api.h +++ b/src/p2pool_api.h @@ -38,7 +38,7 @@ public: void on_stop(); template - void set(const Category& category, const char* filename, T&& callback) { dump_to_file_async_internal(category, filename, DumpFileCallback(std::move(callback))); } + void set(Category category, const char* filename, T&& callback) { dump_to_file_async_internal(category, filename, DumpFileCallback(std::move(callback))); } private: void create_dir(const std::string& path); @@ -72,7 +72,7 @@ private: T m_callback; }; - void dump_to_file_async_internal(const Category& category, const char* filename, DumpFileCallbackBase&& callback); + void dump_to_file_async_internal(Category category, const char* filename, DumpFileCallbackBase&& callback); void dump_to_file(); static void on_fs_open(uv_fs_t* req); static void on_fs_write(uv_fs_t* req); diff --git a/src/pow_hash.cpp b/src/pow_hash.cpp index e9ba231..90b23cd 100644 --- a/src/pow_hash.cpp +++ b/src/pow_hash.cpp @@ -440,7 +440,9 @@ bool RandomX_Hasher_RPC::calculate(const void* data_ptr, size_t size, uint64_t h volatile int result = 0; volatile bool done = false; - JSONRPCRequest::call(m_pool->params().m_host, m_pool->params().m_rpcPort, buf, m_pool->params().m_rpcLogin, + const Params& params = m_pool->params(); + + JSONRPCRequest::call(params.m_host, params.m_rpcPort, buf, params.m_rpcLogin, [&result, &h](const char* data, size_t size) { rapidjson::Document doc;