]> granicus.if.org Git - apache/commitdiff
Allow WatchdogInterval to be sub 1 second
authorJim Jagielski <jim@apache.org>
Wed, 21 Jun 2017 12:49:54 +0000 (12:49 +0000)
committerJim Jagielski <jim@apache.org>
Wed, 21 Jun 2017 12:49:54 +0000 (12:49 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1799435 13f79535-47bb-0310-9956-ffa450edef68

docs/log-message-tags/next-number
modules/core/mod_watchdog.c

index 8e4ede90cc64266d63a374e1014eebd2ed0a57dc..84fb28fadb797a4507e1f7fba0e7b1b1c85fdfdc 100644 (file)
@@ -1 +1 @@
-10033
+10034
index c4f9857000880b65f700365ea0ed4a2c9b596f1f..b6deaba30616f6596432703b8c05b07f21d41b11 100644 (file)
@@ -449,6 +449,9 @@ static int wd_post_config_hook(apr_pool_t *pconf, apr_pool_t *plog,
         apr_pool_create(&wd_server_conf->pool, ppconf);
         apr_pool_userdata_set(wd_server_conf, pk, apr_pool_cleanup_null, ppconf);
     }
+    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(010033)
+                 "Watchdog: Running with WatchdogInterval %"
+                 APR_TIME_T_FMT "ms", apr_time_as_msec(wd_interval));
     wd_server_conf->s = s;
     if ((wl = ap_list_provider_names(pconf, AP_WATCHDOG_PGROUP,
                                             AP_WATCHDOG_PVERSION))) {
@@ -596,15 +599,20 @@ static void wd_child_init_hook(apr_pool_t *p, server_rec *s)
 static const char *wd_cmd_watchdog_int(cmd_parms *cmd, void *dummy,
                                        const char *arg)
 {
-    int i;
+    apr_status_t rv;
     const char *errs = ap_check_cmd_context(cmd, GLOBAL_ONLY);
 
     if (errs != NULL)
         return errs;
-    if ((i = atoi(arg)) < 1)
-        return "Invalid WatchdogInterval value";
+    rv = ap_timeout_parameter_parse(arg, &wd_interval, "s");
+
+    if (rv != APR_SUCCESS)
+        return "Unparse-able WatchdogInterval setting";
+    if (wd_interval < AP_WD_TM_SLICE) {
+        return apr_psprintf(cmd->pool, "Invalid WatchdogInterval: minimal value %"
+                APR_TIME_T_FMT "ms", apr_time_as_msec(AP_WD_TM_SLICE));
+    }
 
-    wd_interval = apr_time_from_sec(i);
     return NULL;
 }