0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-27 07:54:05 +01:00

ircd::server: Ensure open_opts references are fresh after resolve comes back.

This commit is contained in:
Jason Volk 2018-04-07 06:02:12 -07:00
parent 6488141f64
commit 0012793bf6

View file

@ -104,12 +104,12 @@ ircd::server::create(const net::hostport &hostport)
{
auto peer(std::make_unique<peer>());
peer->hostname = net::canonize(hostport);
peer->resolve(hostport);
peer->open_opts = net::open_opts
{
peer->remote, net::hostport{peer->hostname}
};
peer->resolve(hostport);
return peer;
}
@ -872,13 +872,18 @@ try
this->remote = ipport;
open_opts.ipport = this->remote;
host(open_opts.hostport) = this->hostname;
port(open_opts.hostport) = port(ipport);
open_opts.common_name = this->hostname;
if(unlikely(finished()))
return handle_finished();
if(!op_fini)
for(auto &link : links)
link.open(this->open_opts);
if(op_fini)
return;
for(auto &link : links)
link.open(open_opts);
}
catch(const std::exception &e)
{