0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

ircd::server: Add peer to map before resolve.

This commit is contained in:
Jason Volk 2019-03-22 10:51:11 -07:00
parent eee620df3e
commit e62e65df6b

View file

@ -136,8 +136,11 @@ ircd::server::get(const net::hostport &hostport)
canonized
};
assert(bool(peer));
assert(!empty(peer->hostcanon));
const string_view key{peer->hostcanon};
it = peers.emplace_hint(it, key, std::move(peer));
it->second->resolve(it->second->open_opts.hostport);
assert(it->second->hostcanon.data() == it->first.data());
assert(key == canonized);
}
@ -153,9 +156,6 @@ ircd::server::create(const net::hostport &hostport)
std::make_unique<server::peer>(hostport)
};
// Async DNS resolve. The links for the new peer will be connected
// once the resolver calls back into peer::handle_resolve().
peer->resolve(peer->open_opts.hostport);
return peer;
}