diff --git a/conf_schema.h b/conf_schema.h index c08c64c6..8ba3ebdd 100644 --- a/conf_schema.h +++ b/conf_schema.h @@ -330,6 +330,7 @@ STRUCT(server) STRING(256, chdir, "/", absolute_path,, "Absolute path of chdir(2) for server process") STRING(256, interface_path, "", str_nonempty,, "Path of directory containing interface files, either absolute or relative to instance directory") ATOM(bool_t, respawn_on_crash, 0, boolean,, "If true, server will exec(2) itself on fatal signals, eg SEGV") +ATOM(uint32_t, config_reload_interval_ms, 1000, uint32_nonzero,, "Time interval between configuration reload polls, in milliseconds") SUB_STRUCT(watchdog, watchdog,) END_STRUCT diff --git a/overlay.c b/overlay.c index 1548fcfc..91f954fb 100644 --- a/overlay.c +++ b/overlay.c @@ -126,7 +126,7 @@ int overlayServerMode() SCHEDULE(server_shutdown_check, 0, 100); /* Periodically reload configuration */ - SCHEDULE(server_config_reload, SERVER_CONFIG_RELOAD_INTERVAL_MS, SERVER_CONFIG_RELOAD_INTERVAL_MS + 100); + SCHEDULE(server_config_reload, config.server.config_reload_interval_ms, 100); overlay_mdp_bind_internal_services(); diff --git a/serval.h b/serval.h index cc0454d3..0d483fb3 100644 --- a/serval.h +++ b/serval.h @@ -196,8 +196,6 @@ int strn_to_sid_t(sid_t *sid, const char *hex, const char **endp); #define alloca_tohex_sas(sas) alloca_tohex((sas), SAS_SIZE) -#define SERVER_CONFIG_RELOAD_INTERVAL_MS 1000 - struct cli_parsed; extern int servalShutdown; diff --git a/server.c b/server.c index 0aaca4b7..016a13ca 100644 --- a/server.c +++ b/server.c @@ -219,8 +219,8 @@ void server_config_reload(struct sched_ent *alarm) } if (alarm) { time_ms_t now = gettime_ms(); - alarm->alarm = now + SERVER_CONFIG_RELOAD_INTERVAL_MS; - alarm->deadline = alarm->alarm + 1000; + alarm->alarm = now + config.server.config_reload_interval_ms; + alarm->deadline = alarm->alarm + 100; schedule(alarm); } }