From ac021785a2a95b8fe3d690e7b0dcd87a08a41779 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 28 Feb 2020 10:18:13 -0800 Subject: [PATCH] ircd::net::hostport: Deinline amalgam constructors. --- include/ircd/net/hostport.h | 59 ------------------------------------- ircd/net.cc | 57 +++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 59 deletions(-) diff --git a/include/ircd/net/hostport.h b/include/ircd/net/hostport.h index 700386bf4..11673d1ca 100644 --- a/include/ircd/net/hostport.h +++ b/include/ircd/net/hostport.h @@ -97,65 +97,6 @@ ircd::net::hostport::hostport(const string_view &host, } {} -/// Creates a host:service or host:port pair from the single string literally -/// containing the colon deliminated values. If the suffix is a port number -/// then the behavior for the port number constructor applies; if a service -/// string then the service constructor applies; if empty (just a hostname) -/// then service "matrix" is assumed with port 8448 fallback. -inline -ircd::net::hostport::hostport(const string_view &amalgam) -:host -{ - rfc3986::host(amalgam) -} -,port -{ - rfc3986::port(amalgam) -} -{ - // When the amalgam has no port - if(amalgam == host) - { - // set the port to the canon_port; port=0 is bad - port = port?: canon_port; - return; - } - - // or a valid integer port - if(port) - return; - - // When the port is actually a service string - const auto service - { - rsplit(amalgam, ':').second - }; - - if(service) - this->service = service; - else - this->port = canon_port; -} - -inline -ircd::net::hostport::hostport(const string_view &amalgam, - verbatim_t) -:host -{ - rfc3986::host(amalgam) -} -,service -{ - amalgam != host && !rfc3986::port(amalgam)? - rsplit(amalgam, ':').second: - string_view{} -} -,port -{ - rfc3986::port(amalgam) -} -{} - inline ircd::net::hostport::operator bool() diff --git a/ircd/net.cc b/ircd/net.cc index 0060d1503..81e35e414 100644 --- a/ircd/net.cc +++ b/ircd/net.cc @@ -4365,6 +4365,63 @@ ircd::net::canon_service "matrix" }; +/// Creates a host:service or host:port pair from the single string literally +/// containing the colon deliminated values. If the suffix is a port number +/// then the behavior for the port number constructor applies; if a service +/// string then the service constructor applies; if empty (just a hostname) +/// then service "matrix" is assumed with port 8448 fallback. +ircd::net::hostport::hostport(const string_view &amalgam) +:host +{ + rfc3986::host(amalgam) +} +,port +{ + rfc3986::port(amalgam) +} +{ + // When the amalgam has no port + if(amalgam == host) + { + // set the port to the canon_port; port=0 is bad + port = port?: canon_port; + return; + } + + // or a valid integer port + if(port) + return; + + // When the port is actually a service string + const auto service + { + rsplit(amalgam, ':').second + }; + + if(service) + this->service = service; + else + this->port = canon_port; +} + +ircd::net::hostport::hostport(const string_view &amalgam, + verbatim_t) +:host +{ + rfc3986::host(amalgam) +} +,service +{ + amalgam != host && !rfc3986::port(amalgam)? + rsplit(amalgam, ':').second: + string_view{} +} +,port +{ + rfc3986::port(amalgam) +} +{} + std::ostream & ircd::net::operator<<(std::ostream &s, const hostport &t) {