]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Remove send-announce (#1110)
authorAmos Jeffries <yadij@users.noreply.github.com>
Tue, 9 Aug 2022 21:23:07 +0000 (21:23 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Tue, 9 Aug 2022 21:23:15 +0000 (21:23 +0000)
This is another feature which is very much outdated and unused.

src/Makefile.am
src/SquidConfig.h
src/cache_cf.cc
src/cf.data.pre
src/main.cc
src/send-announce.cc [deleted file]
src/send-announce.h [deleted file]

index ef54d01f74f98d9d2f6d91bbaed1b73d1430739e..2a4912fb0e50fcad5d60f2d1ea502f0c3cbdadb0 100644 (file)
@@ -412,8 +412,6 @@ squid_SOURCES = \
        refresh.h \
        repl_modules.h \
        sbuf/StringConvert.h \
-       send-announce.cc \
-       send-announce.h \
        stat.cc \
        stat.h \
        stmem.cc \
index c70d9ed3e667e74448576695c3f02d5c6e9f370c..d80f6a7e85287d5301a4afce414eed18d269b85d 100644 (file)
@@ -228,13 +228,6 @@ public:
     wordlist *hostnameAliases;
     char *errHtmlText;
 
-    struct {
-        char *host;
-        char *file;
-        time_t period;
-        unsigned short port;
-    } Announce;
-
     struct {
 
         Ip::Address udp_incoming;
@@ -289,7 +282,6 @@ public:
         int buffered_logs;
         int common_log;
         int log_mime_hdrs;
-        int announce;
         int mem_pools;
         int test_reachability;
         int half_closed_clients;
index 5505f84cf47024b3a2836a1f241b02ec110f3f0c..50392b5a0f6b844ffc6255c3ae3db08ef07a2e87 100644 (file)
@@ -731,13 +731,6 @@ configDoConfigure(void)
     }
 #endif
 
-    if (Config.Announce.period > 0) {
-        Config.onoff.announce = 1;
-    } else {
-        Config.Announce.period = 86400 * 365;   /* one year */
-        Config.onoff.announce = 0;
-    }
-
     if (Config.onoff.httpd_suppress_version_string)
         visible_appname_string = (char *)appname_string;
     else
index 63bfa3d2cbc32150ef2d74e04bb3b86a9d758b63..ca8033cfb4c48552c348a860d9f75728cc022aa4 100644 (file)
@@ -182,6 +182,30 @@ DOC_START
 DOC_END
 
 # Options removed in 6.x
+NAME: announce_file
+TYPE: obsolete
+DOC_START
+       Remove this line. Squid no longer supports this feature.
+DOC_END
+
+NAME: announce_host
+TYPE: obsolete
+DOC_START
+       Remove this line. Squid no longer supports this feature.
+DOC_END
+
+NAME: announce_period
+TYPE: obsolete
+DOC_START
+       Remove this line. Squid no longer supports this feature.
+DOC_END
+
+NAME: announce_port
+TYPE: obsolete
+DOC_START
+       Remove this line. Squid no longer supports this feature.
+DOC_END
+
 NAME: request_entities
 TYPE: obsolete
 DOC_START
@@ -7493,73 +7517,6 @@ DOC_START
         your value with 0.
 DOC_END
 
-COMMENT_START
- OPTIONS FOR THE CACHE REGISTRATION SERVICE
- -----------------------------------------------------------------------------
-
-       This section contains parameters for the (optional) cache
-       announcement service.  This service is provided to help
-       cache administrators locate one another in order to join or
-       create cache hierarchies.
-
-       An 'announcement' message is sent (via UDP) to the registration
-       service by Squid.  By default, the announcement message is NOT
-       SENT unless you enable it with 'announce_period' below.
-
-       The announcement message includes your hostname, plus the
-       following information from this configuration file:
-
-               http_port
-               icp_port
-               cache_mgr
-
-       All current information is processed regularly and made
-       available on the Web at http://www.ircache.net/Cache/Tracker/.
-COMMENT_END
-
-NAME: announce_period
-TYPE: time_t
-LOC: Config.Announce.period
-DEFAULT: 0
-DEFAULT_DOC: Announcement messages disabled.
-DOC_START
-       This is how frequently to send cache announcements.
-
-       To enable announcing your cache, just set an announce period.
-
-       Example:
-               announce_period 1 day
-DOC_END
-
-NAME: announce_host
-TYPE: string
-DEFAULT: tracker.ircache.net
-LOC: Config.Announce.host
-DOC_START
-       Set the hostname where announce registration messages will be sent.
-
-       See also announce_port and announce_file
-DOC_END
-
-NAME: announce_file
-TYPE: string
-DEFAULT: none
-LOC: Config.Announce.file
-DOC_START
-       The contents of this file will be included in the announce
-       registration messages.
-DOC_END
-
-NAME: announce_port
-TYPE: u_short
-DEFAULT: 3131
-LOC: Config.Announce.port
-DOC_START
-       Set the port where announce registration messages will be sent.
-
-       See also announce_host and announce_file
-DOC_END
-
 COMMENT_START
  HTTPD-ACCELERATOR OPTIONS
  -----------------------------------------------------------------------------
index c1e665232f5c9c85ea1e5658a55ad00cd365ce8a..7258363044b4583b2f347cab6deb8d008cc8c638 100644 (file)
@@ -69,7 +69,6 @@
 #include "refresh.h"
 #include "sbuf/Stream.h"
 #include "SBufStatsAction.h"
-#include "send-announce.h"
 #include "SquidConfig.h"
 #include "stat.h"
 #include "StatCounters.h"
@@ -1020,14 +1019,6 @@ mainReconfigureFinish(void *)
     Config.ClientDelay.finalize();
 #endif
 
-    if (Config.onoff.announce) {
-        if (!eventFind(start_announce, nullptr))
-            eventAdd("start_announce", start_announce, nullptr, 3600.0, 1);
-    } else {
-        if (eventFind(start_announce, nullptr))
-            eventDelete(start_announce, nullptr);
-    }
-
     reconfiguring = 0;
 }
 
@@ -1324,9 +1315,6 @@ mainInitialize(void)
 
     eventAdd("storeMaintain", Store::Maintain, nullptr, 1.0, 1);
 
-    if (Config.onoff.announce)
-        eventAdd("start_announce", start_announce, nullptr, 3600.0, 1);
-
     eventAdd("ipcache_purgelru", ipcache_purgelru, nullptr, 10.0, 1);
 
     eventAdd("fqdncache_purgelru", fqdncache_purgelru, nullptr, 15.0, 1);
diff --git a/src/send-announce.cc b/src/send-announce.cc
deleted file mode 100644 (file)
index b61414a..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
- *
- * Squid software is distributed under GPLv2+ license and includes
- * contributions from numerous individuals and organizations.
- * Please see the COPYING and CONTRIBUTORS files for details.
- */
-
-/* DEBUG: section 27    Cache Announcer */
-
-#include "squid.h"
-#include "anyp/PortCfg.h"
-#include "comm/Connection.h"
-#include "event.h"
-#include "fd.h"
-#include "fde.h"
-#include "fs_io.h"
-#include "globals.h"
-#include "ICP.h"
-#include "ipcache.h"
-#include "send-announce.h"
-#include "SquidConfig.h"
-#include "tools.h"
-
-static IPH send_announce;
-
-void
-start_announce(void *)
-{
-    if (0 == Config.onoff.announce)
-        return;
-
-    if (!Comm::IsConnOpen(icpOutgoingConn))
-        return;
-
-    ipcache_nbgethostbyname(Config.Announce.host, send_announce, nullptr);
-
-    eventAdd("send_announce", start_announce, nullptr, (double) Config.Announce.period, 1);
-}
-
-static void
-send_announce(const ipcache_addrs *ia, const Dns::LookupDetails &, void *)
-{
-    LOCAL_ARRAY(char, tbuf, 256);
-    LOCAL_ARRAY(char, sndbuf, BUFSIZ);
-
-    char *host = Config.Announce.host;
-    char *file = nullptr;
-    unsigned short port = Config.Announce.port;
-    int l;
-    int n;
-    int fd;
-
-    if (ia == nullptr) {
-        debugs(27, DBG_IMPORTANT, "ERROR: send_announce: Unknown host '" << host << "'");
-        return;
-    }
-
-    debugs(27, DBG_IMPORTANT, "Sending Announcement to " << host);
-    sndbuf[0] = '\0';
-    snprintf(tbuf, 256, "cache_version SQUID/%s\n", version_string);
-    strcat(sndbuf, tbuf);
-    assert(HttpPortList != nullptr);
-    snprintf(tbuf, 256, "Running on %s %d %d\n",
-             getMyHostname(),
-             getMyPort(),
-             (int) Config.Port.icp);
-    strcat(sndbuf, tbuf);
-
-    if (Config.adminEmail) {
-        snprintf(tbuf, 256, "cache_admin: %s\n", Config.adminEmail);
-        strcat(sndbuf, tbuf);
-    }
-
-    snprintf(tbuf, 256, "generated %d [%s]\n",
-             (int) squid_curtime,
-             Time::FormatHttpd(squid_curtime));
-    strcat(sndbuf, tbuf);
-    l = strlen(sndbuf);
-
-    if ((file = Config.Announce.file) != nullptr) {
-        fd = file_open(file, O_RDONLY | O_TEXT);
-
-        if (fd > -1 && (n = FD_READ_METHOD(fd, sndbuf + l, BUFSIZ - l - 1)) > 0) {
-            fd_bytes(fd, n, FD_READ);
-            l += n;
-            sndbuf[l] = '\0';
-            file_close(fd);
-        } else {
-            int xerrno = errno;
-            debugs(50, DBG_IMPORTANT, "send_announce: " << file << ": " << xstrerr(xerrno));
-        }
-    }
-
-    Ip::Address S = ia->current();
-    S.port(port);
-    assert(Comm::IsConnOpen(icpOutgoingConn));
-
-    if (comm_udp_sendto(icpOutgoingConn->fd, S, sndbuf, strlen(sndbuf) + 1) < 0) {
-        int xerrno = errno;
-        debugs(27, DBG_IMPORTANT, "ERROR: Failed to announce to " << S << " from " << icpOutgoingConn->local << ": " << xstrerr(xerrno));
-    }
-}
-
diff --git a/src/send-announce.h b/src/send-announce.h
deleted file mode 100644 (file)
index 6dd74ed..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
- *
- * Squid software is distributed under GPLv2+ license and includes
- * contributions from numerous individuals and organizations.
- * Please see the COPYING and CONTRIBUTORS files for details.
- */
-
-/* DEBUG: section 27    Cache Announcer */
-
-#ifndef SQUID_SEND_ANNOUNCE_H_
-#define SQUID_SEND_ANNOUNCE_H_
-
-void start_announce(void *unused);
-
-#endif /* SQUID_SEND_ANNOUNCE_H_ */
-