mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 00:32:35 +01: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;
|
||||
|
||||
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 conf::item<bool> enable_ipv6;
|
||||
static conf::item<size_t> link_min_default;
|
||||
|
|
|
@ -700,6 +700,16 @@ ircd::server::peers
|
|||
// 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)
|
||||
ircd::server::peer::close_desc
|
||||
{
|
||||
|
@ -759,12 +769,18 @@ ircd::server::peer::peer(const net::hostport &hostport,
|
|||
open_opts
|
||||
}
|
||||
{
|
||||
const net::hostport canon
|
||||
{
|
||||
this->hostcanon
|
||||
};
|
||||
// Socket options
|
||||
this->open_opts.sopts = &peer::sock_opts;
|
||||
|
||||
// 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.service = service(canon);
|
||||
this->open_opts.hostport.port = port(hostport);
|
||||
|
@ -774,14 +790,6 @@ ircd::server::peer::peer(const net::hostport &hostport,
|
|||
|
||||
// Cert verify this name.
|
||||
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()
|
||||
|
|
Loading…
Reference in a new issue