From 533272be9795de994b1bc3280315364f48a32dd1 Mon Sep 17 00:00:00 2001 Message-Id: <533272be9795de994b1bc3280315364f48a32dd1.1713580439.git.mdw@distorted.org.uk> From: Mark Wooding Date: Sun, 14 Feb 2010 11:02:26 +0000 Subject: [PATCH] New refresh_min option to bound below the web interface refresh interval. Organization: Straylight/Edgeware From: Richard Kettlewell --- CHANGES.html | 2 +- cgi/actions.c | 4 ++++ doc/disorder_config.5.in | 6 ++++++ lib/configuration.c | 2 ++ lib/configuration.h | 3 +++ 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGES.html b/CHANGES.html index 0598fc7..9634289 100644 --- a/CHANGES.html +++ b/CHANGES.html @@ -125,7 +125,7 @@ span.command {

Confirmation URLs should be cleaner (and in particular not end with punctuation). (Please see README.upgrades for more about this.)

- +

RTP Player

diff --git a/cgi/actions.c b/cgi/actions.c index 30ddba1..fae533a 100644 --- a/cgi/actions.c +++ b/cgi/actions.c @@ -95,6 +95,10 @@ static void act_playing(void) { if(refresh > config->gap) refresh = config->gap; } + /* Bound the refresh interval below as a back-stop against the above + * calculations coming up with a stupid answer */ + if(refresh < config->refresh_min) + refresh = config->refresh_min; if((action = cgi_get("action"))) url = cgi_makeurl(config->url, "action", action, (char *)0); else diff --git a/doc/disorder_config.5.in b/doc/disorder_config.5.in index ef3a70f..fd38788 100644 --- a/doc/disorder_config.5.in +++ b/doc/disorder_config.5.in @@ -808,8 +808,14 @@ This must be set if you have online registration enabled. .TP .B refresh \fISECONDS\fR Specifies the maximum refresh period in seconds. +The refresh period is the time after which the web interface's queue and manage +pages will automatically reload themselves. Default 15. .TP +.B refresh_min \fISECONDS\fR +Specifies the minimum refresh period in seconds. +Default 1. +.TP .B sendmail \fIPATH\fR The path to the Sendmail executable. This must support the \fB-bs\fR option (Postfix, Exim and Sendmail should all diff --git a/lib/configuration.c b/lib/configuration.c index 98d672b..a4f8b0c 100644 --- a/lib/configuration.c +++ b/lib/configuration.c @@ -1100,6 +1100,7 @@ static const struct conf conf[] = { { C(prefsync), &type_integer, validate_positive }, { C(queue_pad), &type_integer, validate_positive }, { C(refresh), &type_integer, validate_positive }, + { C(refresh_min), &type_integer, validate_non_negative }, { C(reminder_interval), &type_integer, validate_positive }, { C(remote_userman), &type_boolean, validate_any }, { C(replay_min), &type_integer, validate_non_negative }, @@ -1337,6 +1338,7 @@ static struct config *config_default(void) { logname = pw->pw_name; c->username = xstrdup(logname); c->refresh = 15; + c->refresh_min = 1; c->prefsync = 0; c->signal = SIGKILL; c->alias = xstrdup("{/artist}{/album}{/title}{ext}"); diff --git a/lib/configuration.h b/lib/configuration.h index 0371f3e..617d929 100644 --- a/lib/configuration.h +++ b/lib/configuration.h @@ -215,6 +215,9 @@ struct config { /** @brief Maximum refresh interval for web interface (seconds) */ long refresh; + /** @brief Minimum refresh interval for web interface (seconds) */ + long refresh_min; + /** @brief Facilities restricted to trusted users * * A bitmap of @ref RESTRICT_SCRATCH, @ref RESTRICT_REMOVE and @ref -- [mdw]