mirror of
https://github.com/qicosmos/rest_rpc.git
synced 2026-08-29 08:34:47 +08:00
make c++11 happy; avoid asio remote_endpoint exception
This commit is contained in:
@@ -82,7 +82,12 @@ public:
|
||||
return "";
|
||||
}
|
||||
|
||||
return socket_.remote_endpoint().address().to_string();
|
||||
asio::error_code ec;
|
||||
auto endpoint = socket_.remote_endpoint(ec);
|
||||
if (ec) {
|
||||
return "";
|
||||
}
|
||||
return endpoint.address().to_string();
|
||||
}
|
||||
|
||||
void publish(const std::string &key, const std::string &data) {
|
||||
|
||||
@@ -229,7 +229,7 @@ public:
|
||||
call(const std::string &rpc_name, Args &&...args) {
|
||||
auto future_result =
|
||||
async_call<FUTURE>(rpc_name, std::forward<Args>(args)...);
|
||||
std::shared_ptr<bool> guard(nullptr, [this, &future_result](auto) {
|
||||
std::shared_ptr<bool> guard(nullptr, [this, &future_result](bool *) {
|
||||
std::unique_lock<std::mutex> lock(cb_mtx_);
|
||||
future_map_.erase(future_result.id);
|
||||
});
|
||||
@@ -253,7 +253,7 @@ public:
|
||||
call(const std::string &rpc_name, Args &&...args) {
|
||||
auto future_result =
|
||||
async_call<FUTURE>(rpc_name, std::forward<Args>(args)...);
|
||||
std::shared_ptr<bool> guard(nullptr, [this, &future_result](auto) {
|
||||
std::shared_ptr<bool> guard(nullptr, [this, &future_result](bool *) {
|
||||
std::unique_lock<std::mutex> lock(cb_mtx_);
|
||||
future_map_.erase(future_result.id);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user