summaryrefslogtreecommitdiff
path: root/src/socket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/socket.cpp')
-rw-r--r--src/socket.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/socket.cpp b/src/socket.cpp
index 411465ad6..31fbffb61 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -47,10 +47,8 @@ ListenSocket::ListenSocket(InspIRCd* Instance, int port, char* addr) : ServerIns
if ((!*addr) || (strchr(addr,':')))
this->family = AF_INET6;
else
- this->family = AF_INET;
-#else
- this->family = AF_INET;
#endif
+ this->family = AF_INET;
Instance->SE->AddFd(this);
}
}
@@ -81,14 +79,12 @@ void ListenSocket::HandleEvent(EventType et, int errornum)
length = sizeof(sockaddr_in6);
}
else
+#endif
{
uslen = sizeof(sockaddr_in);
length = sizeof(sockaddr_in);
}
-#else
- uslen = sizeof(sockaddr_in);
- length = sizeof(sockaddr_in);
-#endif
+
incomingSockfd = _accept (this->GetFd(), (sockaddr*)client, &length);
if ((incomingSockfd > -1) && (!_getsockname(incomingSockfd, sock_us, &uslen)))
@@ -101,14 +97,12 @@ void ListenSocket::HandleEvent(EventType et, int errornum)
in_port = ntohs(((sockaddr_in6*)sock_us)->sin6_port);
}
else
+#endif
{
inet_ntop(AF_INET, &((const sockaddr_in*)client)->sin_addr, buf, sizeof(buf));
in_port = ntohs(((sockaddr_in*)sock_us)->sin_port);
}
-#else
- inet_ntop(AF_INET, &((const sockaddr_in*)client)->sin_addr, buf, sizeof(buf));
- in_port = ntohs(((sockaddr_in*)sock_us)->sin_port);
-#endif
+
NonBlocking(incomingSockfd);
if (ServerInstance->Config->GetIOHook(in_port))
{