diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-08-04 12:12:07 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-08-04 12:12:07 +0200 |
commit | 984db9e30147952f67be1a8f23b381e88ea79634 (patch) | |
tree | 5e1448813037503f971a8d68a928bc70985ea474 | |
parent | e17db7c63a53cb834e2cc8d221d759bdf2c2b69b (diff) |
Remove InspIRCd::BindSocket()
-rw-r--r-- | include/inspircd.h | 9 | ||||
-rw-r--r-- | src/socket.cpp | 52 |
2 files changed, 0 insertions, 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; |