From 984db9e30147952f67be1a8f23b381e88ea79634 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 4 Aug 2014 12:12:07 +0200 Subject: Remove InspIRCd::BindSocket() --- include/inspircd.h | 9 --------- src/socket.cpp | 52 ---------------------------------------------------- 2 files changed, 61 deletions(-) diff --git a/include/inspircd.h b/include/inspircd.h index 5a7f3ae02..bebe1dea0 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -436,15 +436,6 @@ class CoreExport InspIRCd */ int BindPorts(FailedPortList &failed_ports); - /** Binds a socket on an already open file descriptor - * @param sockfd A valid file descriptor of an open socket - * @param port The port number to bind to - * @param addr The address to bind to (IP only) - * @param dolisten Should this port be listened on? - * @return True if the port was bound successfully - */ - bool BindSocket(int sockfd, int port, const char* addr, bool dolisten = true); - /** Find a user in the nick hash. * If the user cant be found in the nick hash check the uuid hash * @param nick The nickname to find diff --git a/src/socket.cpp b/src/socket.cpp index 89c9969ff..17f13bb8a 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -23,58 +23,6 @@ #include "inspircd.h" -using irc::sockets::sockaddrs; - -/** This will bind a socket to a port. It works for UDP/TCP. - * It can only bind to IP addresses, if you wish to bind to hostnames - * you should first resolve them using class 'Resolver'. - */ -bool InspIRCd::BindSocket(int sockfd, int port, const char* addr, bool dolisten) -{ - sockaddrs servaddr; - int ret; - - if ((*addr == '*' || *addr == '\0') && port == -1) - { - /* Port -1: Means UDP IPV4 port binding - Special case - * used by DNS engine. - */ - memset(&servaddr, 0, sizeof(servaddr)); - servaddr.in4.sin_family = AF_INET; - } - else if (!irc::sockets::aptosa(addr, port, servaddr)) - return false; - - ret = SocketEngine::Bind(sockfd, servaddr); - - if (ret < 0) - { - return false; - } - else - { - if (dolisten) - { - if (SocketEngine::Listen(sockfd, Config->MaxConn) == -1) - { - this->Logs->Log("SOCKET", LOG_DEFAULT, "ERROR in listen(): %s",strerror(errno)); - return false; - } - else - { - this->Logs->Log("SOCKET", LOG_DEBUG, "New socket binding for %d with listen: %s:%d", sockfd, addr, port); - SocketEngine::NonBlocking(sockfd); - return true; - } - } - else - { - this->Logs->Log("SOCKET", LOG_DEBUG, "New socket binding for %d without listen: %s:%d", sockfd, addr, port); - return true; - } - } -} - int InspIRCd::BindPorts(FailedPortList &failed_ports) { int bound = 0; -- cgit v1.2.3