diff options
Diffstat (limited to 'src/socket.cpp')
-rw-r--r-- | src/socket.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/socket.cpp b/src/socket.cpp index d2090c3a2..b0206da29 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -150,7 +150,13 @@ int irc::sockets::OpenTCPSocket(const char* addr, int socktype) addr = addr; struct linger linger = { 0, 0 }; #ifdef IPV6 - if (strchr(addr,':') || (!*addr)) + if (!*addr) + { + sockfd = socket (PF_INET6, socktype, 0); + if (sockfd < 0) + sockfd = socket (PF_INET, socktype, 0); + } + else if (strchr(addr,':')) sockfd = socket (PF_INET6, socktype, 0); else sockfd = socket (PF_INET, socktype, 0); |