This patch is mainly refactor the rpc_address class.
Remove the constructor rpc_address(const char *host, uint16_t port) and
add a corresponding variants static rpc_address from_host_port(...).
Because there is a DNS resolve procedure which may be slow, avoid to do it
in constructor.
New variants static rpc_address from_ip_port(...) are introduced to
distinguish the input parameter is hostname or IPv4 address, it would be
much faster if we know it's a IPv4 address.
Remove std::string to_std_string(), void assign_ipv4*(...) and
bool from_string_ipv4() because they're duplicate.
This patch is mainly refactor the rpc_address class.
rpc_address(const char *host, uint16_t port)
and add a corresponding variantsstatic rpc_address from_host_port(...)
. Because there is a DNS resolve procedure which may be slow, avoid to do it in constructor.static rpc_address from_ip_port(...)
are introduced to distinguish the input parameter is hostname or IPv4 address, it would be much faster if we know it's a IPv4 address.std::string to_std_string()
,void assign_ipv4*(...)
andbool from_string_ipv4()
because they're duplicate.operator bool() const
for convenient use.