mirror of
https://github.com/matrix-construct/construct
synced 2024-10-01 05:08:59 +02:00
ircd::server: Add sock_opts in peer open_opts; move constant; minor cleanup.
This commit is contained in:
parent
75a88976dc
commit
2c48499db7
2 changed files with 22 additions and 13 deletions
|
@ -22,7 +22,8 @@ struct ircd::server::peer
|
||||||
{
|
{
|
||||||
struct err;
|
struct err;
|
||||||
|
|
||||||
static constexpr const size_t &LINK_MAX{16};
|
static const size_t LINK_MAX;
|
||||||
|
static net::sock_opts sock_opts;
|
||||||
static ios::descriptor close_desc;
|
static ios::descriptor close_desc;
|
||||||
static conf::item<bool> enable_ipv6;
|
static conf::item<bool> enable_ipv6;
|
||||||
static conf::item<size_t> link_min_default;
|
static conf::item<size_t> link_min_default;
|
||||||
|
|
|
@ -700,6 +700,16 @@ ircd::server::peers
|
||||||
// server::peer
|
// server::peer
|
||||||
//
|
//
|
||||||
|
|
||||||
|
decltype(ircd::server::peer::LINK_MAX)
|
||||||
|
ircd::server::peer::LINK_MAX
|
||||||
|
{
|
||||||
|
16
|
||||||
|
};
|
||||||
|
|
||||||
|
decltype(ircd::server::peer::sock_opts)
|
||||||
|
ircd::server::peer::sock_opts
|
||||||
|
{};
|
||||||
|
|
||||||
decltype(ircd::server::peer::close_desc)
|
decltype(ircd::server::peer::close_desc)
|
||||||
ircd::server::peer::close_desc
|
ircd::server::peer::close_desc
|
||||||
{
|
{
|
||||||
|
@ -759,12 +769,18 @@ ircd::server::peer::peer(const net::hostport &hostport,
|
||||||
open_opts
|
open_opts
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const net::hostport canon
|
// Socket options
|
||||||
{
|
this->open_opts.sopts = &peer::sock_opts;
|
||||||
this->hostcanon
|
|
||||||
};
|
|
||||||
|
|
||||||
// Ensure references are to this class's members
|
// Ensure references are to this class's members
|
||||||
|
const net::hostport canon{this->hostcanon};
|
||||||
|
if(rfc3986::valid(std::nothrow, rfc3986::parser::ip_address, host(canon)))
|
||||||
|
this->remote =
|
||||||
|
{
|
||||||
|
host(canon), port(hostport)
|
||||||
|
};
|
||||||
|
|
||||||
|
this->open_opts.ipport = this->remote;
|
||||||
this->open_opts.hostport.host = host(canon);
|
this->open_opts.hostport.host = host(canon);
|
||||||
this->open_opts.hostport.service = service(canon);
|
this->open_opts.hostport.service = service(canon);
|
||||||
this->open_opts.hostport.port = port(hostport);
|
this->open_opts.hostport.port = port(hostport);
|
||||||
|
@ -774,14 +790,6 @@ ircd::server::peer::peer(const net::hostport &hostport,
|
||||||
|
|
||||||
// Cert verify this name.
|
// Cert verify this name.
|
||||||
this->open_opts.common_name = host(canon);
|
this->open_opts.common_name = host(canon);
|
||||||
|
|
||||||
if(rfc3986::valid(std::nothrow, rfc3986::parser::ip_address, host(canon)))
|
|
||||||
this->remote =
|
|
||||||
{
|
|
||||||
host(canon), port(hostport)
|
|
||||||
};
|
|
||||||
|
|
||||||
this->open_opts.ipport = this->remote;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ircd::server::peer::~peer()
|
ircd::server::peer::~peer()
|
||||||
|
|
Loading…
Reference in a new issue