From d06715d9eeaa583c8a8a777cf0bfd39c294cc142 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sat, 24 Aug 2019 19:41:14 +0200 Subject: [PATCH] REMOTEINC_SPECIALCACHE is no longer optional --- include/config.h | 18 ------------------ src/conf.c | 14 -------------- src/serv.c | 10 ---------- 3 files changed, 42 deletions(-) diff --git a/include/config.h b/include/config.h index 9a78bb8a2..673a3bf23 100644 --- a/include/config.h +++ b/include/config.h @@ -76,24 +76,6 @@ /* Permit remote /rehash */ #define REMOTE_REHASH -/* - * Special remote include caching, see this Changelog item: - * - Added special caching of remote includes. When a remote include fails to - * load (for example when the webserver is down), then the most recent - * version of that remote include will be used, and the ircd will still boot - * and be able to rehash. Even though this is quite a simple feature, it - * can make a key difference when deciding to roll out remote includes on - * your network. Previously, servers would be unable to boot or rehash when - * the webserver was down, which would be a big problem (often unacceptable). - * The latest version of fetched urls are cached in the cache/ directory as - * cache/. - * Obviously, if there's no 'latest version' and an url fails, the ircd will - * still not be able to boot. This would be the case if you added or changed - * the path of a remote include and it's trying to fetch it for the first time. - * There usually is no reason to disable this. - */ -#define REMOTEINC_SPECIALCACHE - /* ** Freelinks garbage collector -Stskeeps ** diff --git a/src/conf.c b/src/conf.c index d7c95d29a..41b523a62 100644 --- a/src/conf.c +++ b/src/conf.c @@ -10093,9 +10093,7 @@ static void conf_download_complete(const char *url, const char *file, const char if (cached) { unreal_copyfileex(inc->file, tmp, 1); -#ifdef REMOTEINC_SPECIALCACHE unreal_copyfileex(inc->file, unreal_mkcache(url), 0); -#endif update_remote_include(inc, tmp, 0, NULL); } else @@ -10106,9 +10104,7 @@ static void conf_download_complete(const char *url, const char *file, const char */ unreal_copyfileex(file, tmp, 1); update_remote_include(inc, tmp, 0, NULL); -#ifdef REMOTEINC_SPECIALCACHE unreal_copyfileex(file, unreal_mkcache(url), 0); -#endif } } for (inc = conf_include; inc; inc = inc->next) @@ -10323,7 +10319,6 @@ int remote_include(ConfigEntry *ce) file = download_file(url, &error); if (!file) { -#ifdef REMOTEINC_SPECIALCACHE if (has_cached_version(url)) { config_warn("%s:%i: include: error downloading '%s': %s -- using cached version instead.", @@ -10332,18 +10327,13 @@ int remote_include(ConfigEntry *ce) file = strdup(unreal_mkcache(url)); /* Let it pass to load_conf()... */ } else { -#endif config_error("%s:%i: include: error downloading '%s': %s", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, displayurl(url), error); return -1; -#ifdef REMOTEINC_SPECIALCACHE } -#endif } else { -#ifdef REMOTEINC_SPECIALCACHE unreal_copyfileex(file, unreal_mkcache(url), 0); -#endif } add_remote_include(file, url, 0, NULL, ce->ce_fileptr->cf_filename, ce->ce_varlinenum); ret = load_conf(file, url); @@ -10354,7 +10344,6 @@ int remote_include(ConfigEntry *ce) { if (errorbuf) { -#ifdef REMOTEINC_SPECIALCACHE if (has_cached_version(url)) { config_warn("%s:%i: include: error downloading '%s': %s -- using cached version instead.", @@ -10363,14 +10352,11 @@ int remote_include(ConfigEntry *ce) /* Let it pass to load_conf()... */ file = strdup(unreal_mkcache(url)); } else { -#endif config_error("%s:%i: include: error downloading '%s': %s", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, displayurl(url), errorbuf); return -1; -#ifdef REMOTEINC_SPECIALCACHE } -#endif } if (config_verbose > 0) config_status("Loading %s from download", url); diff --git a/src/serv.c b/src/serv.c index d2e906575..21fbcbd48 100644 --- a/src/serv.c +++ b/src/serv.c @@ -928,11 +928,7 @@ void read_motd(const char *filename, aMotdFile *themotd) motd_download->themotd = themotd; themotd->motd_download = motd_download; -#ifdef REMOTEINC_SPECIALCACHE modtime = unreal_getfilemodtime(unreal_mkcache(filename)); -#else - modtime = 0; -#endif download_file_async(filename, modtime, (vFP)read_motd_asynch_downloaded, motd_download); return; @@ -971,25 +967,20 @@ void read_motd_asynch_downloaded(const char *url, const char *filename, const ch /* errors -- check for specialcached version if applicable */ if(!cached && !filename) { -#ifdef REMOTEINC_SPECIALCACHE if(has_cached_version(url)) { config_warn("Error downloading MOTD file from \"%s\": %s -- using cached version instead.", displayurl(url), errorbuf); filename = unreal_mkcache(url); } else { -#endif config_error("Error downloading MOTD file from \"%s\": %s", displayurl(url), errorbuf); /* remove reference to this chunk of memory about to be freed. */ motd_download->themotd->motd_download = NULL; MyFree(motd_download); return; -#ifdef REMOTEINC_SPECIALCACHE } -#endif } -#ifdef REMOTEINC_SPECIALCACHE /* * We need to move our newly downloaded file to its cache file * if it isn't there already. @@ -1005,7 +996,6 @@ void read_motd_asynch_downloaded(const char *url, const char *filename, const ch */ filename = unreal_mkcache(url); } -#endif do_read_motd(filename, themotd); MyFree(motd_download);