From 9e0cde2280b79a5929faed2c48425353a08a74ba Mon Sep 17 00:00:00 2001 From: qicosmos Date: Thu, 21 Apr 2022 03:06:57 +0000 Subject: [PATCH 1/3] add header file --- include/rest_rpc/rpc_client.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/rest_rpc/rpc_client.hpp b/include/rest_rpc/rpc_client.hpp index 8f6dd4b..8481e42 100644 --- a/include/rest_rpc/rpc_client.hpp +++ b/include/rest_rpc/rpc_client.hpp @@ -8,6 +8,7 @@ #include #include #include +#include #include using namespace rest_rpc::rpc_service; From 236f14ba8dd75c142fefcb6957b404b01969be8d Mon Sep 17 00:00:00 2001 From: qicosmos Date: Thu, 21 Apr 2022 03:24:42 +0000 Subject: [PATCH 2/3] fix null pointer --- include/rest_rpc/rpc_client.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/rest_rpc/rpc_client.hpp b/include/rest_rpc/rpc_client.hpp index 8481e42..b0563f2 100644 --- a/include/rest_rpc/rpc_client.hpp +++ b/include/rest_rpc/rpc_client.hpp @@ -630,7 +630,7 @@ private: auto &f = future_map_[req_id]; if (ec) { // LOG<set_value(req_result{""}); return; From ee5fd90770c2469c4ed1a9a3506eddad8f33f181 Mon Sep 17 00:00:00 2001 From: qicosmos Date: Thu, 21 Apr 2022 03:34:47 +0000 Subject: [PATCH 3/3] remove some --- include/rest_rpc/rpc_client.hpp | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/include/rest_rpc/rpc_client.hpp b/include/rest_rpc/rpc_client.hpp index b0563f2..75a4d4a 100644 --- a/include/rest_rpc/rpc_client.hpp +++ b/include/rest_rpc/rpc_client.hpp @@ -202,29 +202,6 @@ public: bool has_connected() const { return has_connected_; } // sync call -#if __cplusplus > 201402L - template - auto call(const std::string &rpc_name, Args &&...args) { - std::future future = - async_call(rpc_name, std::forward(args)...); - auto status = future.wait_for(std::chrono::milliseconds(TIMEOUT)); - if (status == std::future_status::timeout || - status == std::future_status::deferred) { - throw std::out_of_range("timeout or deferred"); - } - - if constexpr (std::is_void_v) { - future.get().as(); - } else { - return future.get().template as(); - } - } - - template - auto call(const std::string &rpc_name, Args &&...args) { - return call(rpc_name, std::forward(args)...); - } -#else template typename std::enable_if::value>::type call(const std::string &rpc_name, Args &&...args) { @@ -272,7 +249,6 @@ public: call(const std::string &rpc_name, Args &&...args) { return call(rpc_name, std::forward(args)...); } -#endif template future_result async_call(const std::string &rpc_name,