net/ToString: check family==AF_INET6 instead of looking for colons
This commit is contained in:
@@ -76,7 +76,7 @@ ToString(SocketAddress address) noexcept
|
|||||||
|
|
||||||
if (serv[0] != 0 && (serv[0] != '0' || serv[1] != 0)) {
|
if (serv[0] != 0 && (serv[0] != '0' || serv[1] != 0)) {
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
if (std::strchr(host, ':') != nullptr) {
|
if (address.GetFamily() == AF_INET6) {
|
||||||
return fmt::format("[{}]:{}", host, serv);
|
return fmt::format("[{}]:{}", host, serv);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user