New refresh_min option to bound below the web interface refresh
authorRichard Kettlewell <rjk@greenend.org.uk>
Sun, 14 Feb 2010 11:02:26 +0000 (11:02 +0000)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sun, 14 Feb 2010 11:02:26 +0000 (11:02 +0000)
interval.

CHANGES.html
cgi/actions.c
doc/disorder_config.5.in
lib/configuration.c
lib/configuration.h

index 0598fc7..9634289 100644 (file)
@@ -125,7 +125,7 @@ span.command {
       <p>Confirmation URLs should be cleaner (and in particular not end
       with punctuation).  (Please see <a
       href="README.upgrades">README.upgrades</a> for more about this.)</p>
       <p>Confirmation URLs should be cleaner (and in particular not end
       with punctuation).  (Please see <a
       href="README.upgrades">README.upgrades</a> for more about this.)</p>
-      
+
     </div>
       
     <h3>RTP Player</h3>
     </div>
       
     <h3>RTP Player</h3>
index 30ddba1..fae533a 100644 (file)
@@ -95,6 +95,10 @@ static void act_playing(void) {
     if(refresh > config->gap)
       refresh = config->gap;
   }
     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
   if((action = cgi_get("action")))
     url = cgi_makeurl(config->url, "action", action, (char *)0);
   else
index ef3a70f..fd38788 100644 (file)
@@ -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.
 .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
 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
 .B sendmail \fIPATH\fR
 The path to the Sendmail executable.
 This must support the \fB-bs\fR option (Postfix, Exim and Sendmail should all
index 98d672b..a4f8b0c 100644 (file)
@@ -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(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 },
   { 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;
   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}");
   c->prefsync = 0;
   c->signal = SIGKILL;
   c->alias = xstrdup("{/artist}{/album}{/title}{ext}");
index 0371f3e..617d929 100644 (file)
@@ -215,6 +215,9 @@ struct config {
   /** @brief Maximum refresh interval for web interface (seconds) */
   long refresh;
 
   /** @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
   /** @brief Facilities restricted to trusted users
    *
    * A bitmap of @ref RESTRICT_SCRATCH, @ref RESTRICT_REMOVE and @ref