From 22f013a06f6015ab7601329a632001770cd14941 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sun, 7 Jul 2013 14:27:54 +0100 Subject: Use the preprocessor to check for TCP deferring support. --- configure | 17 ----------------- make/test/so_acceptfilter.cpp | 27 --------------------------- make/test/tcp_defer_accept.cpp | 27 --------------------------- src/listensocket.cpp | 7 ++----- 4 files changed, 2 insertions(+), 76 deletions(-) delete mode 100644 make/test/so_acceptfilter.cpp delete mode 100644 make/test/tcp_defer_accept.cpp diff --git a/configure b/configure index 19b4e7c26..4bb808f9e 100755 --- a/configure +++ b/configure @@ -298,18 +298,6 @@ if (test_file($config{CXX}, "eventfd.cpp")) { print "no\n"; } -printf "Checking if a TCP deferring mechanism is available... "; -if (test_file($config{CXX}, "tcp_defer_accept.cpp")) { - $config{HAS_DEFER} = "TCP_DEFER_ACCEPT"; - print "yes (TCP_DEFER_ACCEPT)\n"; -} elsif (test_file($config{CXX}, "so_acceptfilter.cpp")) { - $config{HAS_DEFER} = "SO_ACCEPTFILTER"; - print "yes (SO_ACCEPTFILTER)\n"; -} else { - $config{HAS_DEFER} = "false"; - print "no\n"; -} - print "Checking whether epoll is available... "; $config{HAS_EPOLL} = test_header($config{CXX}, "sys/epoll.h"); print $config{HAS_EPOLL} ? "yes\n" : "no\n"; @@ -791,11 +779,6 @@ EOF if ($config{HAS_CLOCK_GETTIME} eq 'true') { print FILEHANDLE "#define HAS_CLOCK_GETTIME\n"; } - if ($config{HAS_DEFER} eq "TCP_DEFER_ACCEPT") { - print FILEHANDLE "#define USE_TCP_DEFER_ACCEPT\n"; - } elsif ($config{HAS_DEFER} eq "SO_ACCEPTFILTER") { - print FILEHANDLE "#define USE_SO_ACCEPTFILTER\n" - } print FILEHANDLE "\n#include \"threadengines/threadengine_pthread.h\"\n"; close(FILEHANDLE); diff --git a/make/test/so_acceptfilter.cpp b/make/test/so_acceptfilter.cpp deleted file mode 100644 index 0fd4cda4f..000000000 --- a/make/test/so_acceptfilter.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * InspIRCd -- Internet Relay Chat Daemon - * - * - * This file is part of InspIRCd. InspIRCd is free software: you can - * redistribute it and/or modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation, version 2. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include - -#ifndef SO_ACCEPTFILTER - #error -#endif - -int main() -{ - return 0; -} diff --git a/make/test/tcp_defer_accept.cpp b/make/test/tcp_defer_accept.cpp deleted file mode 100644 index 191b1ac70..000000000 --- a/make/test/tcp_defer_accept.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * InspIRCd -- Internet Relay Chat Daemon - * - * - * This file is part of InspIRCd. InspIRCd is free software: you can - * redistribute it and/or modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation, version 2. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include - -#ifndef TCP_DEFER_ACCEPT - #error -#endif - -int main() -{ - return 0; -} diff --git a/src/listensocket.cpp b/src/listensocket.cpp index 20cbe51ac..9b69b53ff 100644 --- a/src/listensocket.cpp +++ b/src/listensocket.cpp @@ -21,10 +21,7 @@ #include "inspircd.h" #include "socket.h" #include "socketengine.h" - -#ifdef USE_TCP_DEFER_ACCEPT #include -#endif ListenSocket::ListenSocket(ConfigTag* tag, const irc::sockets::sockaddrs& bind_to) : bind_tag(tag) @@ -63,9 +60,9 @@ ListenSocket::ListenSocket(ConfigTag* tag, const irc::sockets::sockaddrs& bind_t int timeout = tag->getInt("defer", 0); if (timeout && !rv) { -#ifdef USE_TCP_DEFER_ACCEPT +#if defined TCP_DEFER_ACCEPT setsockopt(fd, IPPROTO_TCP, TCP_DEFER_ACCEPT, &timeout, sizeof(timeout)); -#elif defined USE_SO_ACCEPTFILTER +#elif defined SO_ACCEPTFILTER struct accept_filter_arg afa; memset(&afa, 0, sizeof(afa)); strcpy(afa.af_name, "dataready"); -- cgit v1.2.3