Open RFoe opened 2 months ago
https://github.com/RFoe/coasync/blob/a466688370ce4bc5feefc8a55d960de447dfbfde/include/coasync/net/rpc/rpc_client.hpp#L10 https://github.com/RFoe/coasync/blob/a466688370ce4bc5feefc8a55d960de447dfbfde/include/coasync/net/rpc/rpc_server.hpp#L21
co_await client.call<int>("add", 888, 999) | timeout(3s);
net::rpc::rpc_server server {std::move(acceptor), [](std::error_code& ec) {...;} }; co_await server.start() | on_error{[](std::error_code& ec) {...;}};
co_await client.call("add", 888, 999) | on_error([](std::error_code& ec) {...;});
+ 优雅的抑制响应/断开连接 ```cpp // common definition enum option_set { suppress_response_requested = 0, shut_down_requested, } // server side rpc_server.bind("generic_control", [] (net::rpc::control_token token, int option) -> void { if(option == shut_down_requested) token.request_close(); else if (option == shut_down_requested) token.request_noresponse(); return; }); // client side co_await rpc_client.call_nonblock<void>("generic_control", option_set::suppress_response_requested); co_await rpc_client.call_nonblock<void>("generic_control", option_set::shut_down_requested);
https://github.com/RFoe/coasync/blob/a466688370ce4bc5feefc8a55d960de447dfbfde/include/coasync/net/rpc/rpc_client.hpp#L10 https://github.com/RFoe/coasync/blob/a466688370ce4bc5feefc8a55d960de447dfbfde/include/coasync/net/rpc/rpc_server.hpp#L21
rpc功能还是过于简单
co_await client.call("add", 888, 999) | on_error([](std::error_code& ec) {...;});