From 248a14477c435ef28b71df42080ec931b1003e3f Mon Sep 17 00:00:00 2001 From: danieldg Date: Tue, 1 Sep 2009 15:08:09 +0000 Subject: Remove unneeded #ifdef IPV6 lines git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11582 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/socket.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/socket.cpp') diff --git a/src/socket.cpp b/src/socket.cpp index 4d3509836..3b0c63931 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -36,7 +36,6 @@ bool InspIRCd::BindSocket(int sockfd, int port, const char* addr, bool dolisten) } else { -#ifdef IPV6 if (port == -1) { /* Port -1: Means UDP IPV4 port binding - Special case @@ -48,17 +47,19 @@ bool InspIRCd::BindSocket(int sockfd, int port, const char* addr, bool dolisten) } else { - /* There's no address here, default to ipv6 bind to all */ + /* No address */ +#ifdef IPV6 + /* Default to ipv6 bind to all */ servaddr.in6.sin6_family = AF_INET6; servaddr.in6.sin6_port = htons(port); memset(&servaddr.in6.sin6_addr, 0, sizeof(servaddr.in6.sin6_addr)); - } #else - /* Bind ipv4 to all */ - servaddr.in4.sin_family = AF_INET; - servaddr.in4.sin_addr.s_addr = htonl(INADDR_ANY); - servaddr.in4.sin_port = htons(port); + /* Bind ipv4 to all */ + servaddr.in4.sin_family = AF_INET; + servaddr.in4.sin_addr.s_addr = htonl(INADDR_ANY); + servaddr.in4.sin_port = htons(port); #endif + } } ret = SE->Bind(sockfd, &servaddr.sa, sizeof(servaddr)); @@ -97,21 +98,20 @@ int irc::sockets::OpenTCPSocket(const char* addr, int socktype) int on = 1; addr = addr; struct linger linger = { 0, 0 }; -#ifdef IPV6 if (!*addr) { +#ifdef IPV6 sockfd = socket (PF_INET6, socktype, 0); if (sockfd < 0) +#endif sockfd = socket (PF_INET, socktype, 0); } else if (strchr(addr,':')) sockfd = socket (PF_INET6, socktype, 0); else sockfd = socket (PF_INET, socktype, 0); + if (sockfd < 0) -#else - if ((sockfd = socket (PF_INET, socktype, 0)) < 0) -#endif { return ERROR; } -- cgit v1.2.3