This commit is contained in:
qicosmos
2025-10-01 20:29:26 +08:00
parent 139a8144a8
commit 6d95986aa8
4 changed files with 21 additions and 21 deletions
@@ -24,9 +24,9 @@ template <> struct call_result<void> {
rpc_errc ec;
};
class rest_rpc_client {
class rpc_client {
public:
rest_rpc_client() : socket_(get_global_executor()) {}
rpc_client() : socket_(get_global_executor()) {}
auto get_executor() { return socket_.get_executor(); }
@@ -6,10 +6,10 @@
#include <string>
#include <thread>
namespace rest_rpc {
class rest_rpc_server {
class rpc_server {
public:
rest_rpc_server(std::string address,
size_t num_thread = std::thread::hardware_concurrency())
rpc_server(std::string address,
size_t num_thread = std::thread::hardware_concurrency())
: io_context_pool_(num_thread),
acceptor_(io_context_pool_.get_io_context()),
check_timer_(io_context_pool_.get_io_context()) {
@@ -20,13 +20,13 @@ public:
}
}
rest_rpc_server(std::string host, std::string port,
size_t num_thread = std::thread::hardware_concurrency())
rpc_server(std::string host, std::string port,
size_t num_thread = std::thread::hardware_concurrency())
: io_context_pool_(num_thread),
acceptor_(io_context_pool_.get_io_context()), host_(std::move(host)),
port_(std::move(port)),
check_timer_(io_context_pool_.get_io_context()) {}
~rest_rpc_server() { stop(); }
~rpc_server() { stop(); }
std::error_code start() { return start_impl(false); }