summaryrefslogtreecommitdiff
path: root/src/socket.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-01 15:08:09 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-01 15:08:09 +0000
commit248a14477c435ef28b71df42080ec931b1003e3f (patch)
tree0a774b72a92e2fe3581e75db2173a72151023bbe /src/socket.cpp
parent5ad936b13f317cb277bf03c19e9734d931b1bd00 (diff)
Remove unneeded #ifdef IPV6 lines
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11582 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/socket.cpp')
-rw-r--r--src/socket.cpp22
1 files changed, 11 insertions, 11 deletions
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;
}