Commit 98dc2020 authored by Jakob Otto's avatar Jakob Otto

Remove unnecessary move, cleanup resolve

parent 62c2ec1d
......@@ -87,10 +87,10 @@ public:
emplace_return_type res;
{
const std::lock_guard<std::mutex> lock(lock_);
res = peers_.emplace(peer_id, mgr);
res = peers_.emplace(peer_id, std::move(mgr));
}
if (res.second)
return std::move(mgr);
return res.first->second;
else
return make_error(sec::runtime_error, "peer_id already exists");
}
......
......@@ -109,20 +109,10 @@ endpoint_manager_ptr tcp::peer(const node_id& id) {
}
void tcp::resolve(const uri& locator, const actor& listener) {
if (auto id = locator.authority_only()) {
auto p = peer(make_node_id(*id));
if (p == nullptr) {
CAF_LOG_INFO("connecting to " << CAF_ARG(locator));
auto res = get_or_connect(locator);
if (!res)
anon_send(listener, error(sec::cannot_connect_to_node));
if (auto p = get_or_connect(locator))
(*p)->resolve(locator, listener);
else
p = *res;
}
p->resolve(locator, listener);
} else {
anon_send(listener, error(basp::ec::invalid_locator));
}
anon_send(listener, p.error());
}
strong_actor_ptr tcp::make_proxy(node_id nid, actor_id aid) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment