From: Amos Jeffries Date: Tue, 9 Aug 2022 21:23:07 +0000 (+0000) Subject: Remove send-announce (#1110) X-Git-Tag: SQUID_6_0_1~134 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a6e452cdf7238990f058bfaf3245111ec13b7486;p=thirdparty%2Fsquid.git Remove send-announce (#1110) This is another feature which is very much outdated and unused. --- diff --git a/src/Makefile.am b/src/Makefile.am index ef54d01f74..2a4912fb0e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 \ diff --git a/src/SquidConfig.h b/src/SquidConfig.h index c70d9ed3e6..d80f6a7e85 100644 --- a/src/SquidConfig.h +++ b/src/SquidConfig.h @@ -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; diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 5505f84cf4..50392b5a0f 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -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 diff --git a/src/cf.data.pre b/src/cf.data.pre index 63bfa3d2cb..ca8033cfb4 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -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 ----------------------------------------------------------------------------- diff --git a/src/main.cc b/src/main.cc index c1e665232f..7258363044 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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 index b61414a530..0000000000 --- a/src/send-announce.cc +++ /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 index 6dd74edc18..0000000000 --- a/src/send-announce.h +++ /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_ */ -