1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-25 04:16:39 +02:00

REMOTEINC_SPECIALCACHE is no longer optional

This commit is contained in:
Bram Matthys
2019-08-24 19:41:14 +02:00
parent 9e02ca2b3c
commit d06715d9ee
3 changed files with 0 additions and 42 deletions
-18
View File
@@ -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/<md5 hash of url>.
* 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
**
-14
View File
@@ -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);
-10
View File
@@ -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);