speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/3] server - Add support for setting the timeout in the configur


From: Jeremy Whiting
Subject: [PATCH 3/3] server - Add support for setting the timeout in the configuration file
Date: Wed, 29 Jul 2015 18:37:33 -0600

Also looks good.

On Wed, Jul 29, 2015 at 6:15 PM, Luke Yelavich
<luke.yelavich at canonical.com> wrote:
> From: Luke Yelavich <themuso at themuso.com>
>
> A value of 0 either on the command-line or the config file will disable the
> timer. Also adjusted some log levels.
> ---
>  config/speechd.conf        | 6 ++++++
>  src/server/configuration.c | 5 +++++
>  src/server/speechd.c       | 6 +++---
>  3 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/config/speechd.conf b/config/speechd.conf
> index feca758..aa83c69 100644
> --- a/config/speechd.conf
> +++ b/config/speechd.conf
> @@ -42,6 +42,12 @@
>
>  # LocalhostAccessOnly 1
>
> +# By default, Speech Dispatcher is configured to shut itself down after a 
> period of
> +# time if no clients are connected. The timeout value is in seconds, and is 
> started when
> +# the last client disconnects. A value of 0 disables the timeout.
> +
> +# Timeout 5
> +
>  # -----LOGGING CONFIGURATION-----
>
>  # The LogLevel is a number between 0 and 5 specifying the
> diff --git a/src/server/configuration.c b/src/server/configuration.c
> index 3cdc5c7..be38138 100644
> --- a/src/server/configuration.c
> +++ b/src/server/configuration.c
> @@ -218,6 +218,7 @@ GLOBAL_FDSET_OPTION_CB_STR(DefaultModule, output_module)
>                         && (val <= 5), "Invalid log (verbosity) level!")
>      SPEECHD_OPTION_CB_INT(MaxHistoryMessages, max_history_messages, val >= 0,
>                       "Invalid parameter!")
> +    SPEECHD_OPTION_CB_INT_M(Timeout, server_timeout, val < 0, "Invalid 
> timeout value!")
>
>      DOTCONF_CB(cb_LanguageDefaultModule)
>  {
> @@ -426,6 +427,7 @@ configoption_t *load_config_options(int *num_options)
>         ADD_CONFIG_OPTION(DefaultSpelling, ARG_TOGGLE);
>         ADD_CONFIG_OPTION(DefaultCapLetRecognition, ARG_STR);
>         ADD_CONFIG_OPTION(DefaultPauseContext, ARG_INT);
> +       ADD_CONFIG_OPTION(Timeout, ARG_INT);
>         ADD_CONFIG_OPTION(AddModule, ARG_LIST);
>
>         ADD_CONFIG_OPTION(AudioOutputMethod, ARG_STR);
> @@ -483,6 +485,9 @@ void load_default_global_set_options()
>                 SpeechdOptions.port = SPEECHD_DEFAULT_PORT;
>         if (!SpeechdOptions.localhost_access_only_set)
>                 SpeechdOptions.localhost_access_only = 1;
> +       if (!SpeechdOptions.server_timeout_set)
> +               SpeechdOptions.server_timeout = 5;
> +
>
>         logfile = stderr;
>         custom_logfile = NULL;
> diff --git a/src/server/speechd.c b/src/server/speechd.c
> index a515ccb..d790c3f 100644
> --- a/src/server/speechd.c
> +++ b/src/server/speechd.c
> @@ -960,14 +960,14 @@ gboolean client_process_incoming (gint          fd,
>  void check_client_count(void)
>  {
>         if (client_count <= 0
> -           && SpeechdOptions.server_timeout_set) {
> -               MSG(3, "Currently no clients connected, enabling shutdown 
> timer.");
> +           && SpeechdOptions.server_timeout > 0) {
> +               MSG(4, "Currently no clients connected, enabling shutdown 
> timer.");
>                 server_timeout_source =
>                                         g_timeout_add_seconds(
>                                         SpeechdOptions.server_timeout,
>                                         speechd_quit, NULL);
>         } else {
> -       MSG(3, "Clients connected, disabling shutdown timer.");
> +       MSG(4, "Clients connected, disabling shutdown timer.");
>                 g_source_remove(server_timeout_source);
>         }
>  }
> --
> 2.4.6
>
>
> _______________________________________________
> Speechd mailing list
> Speechd at lists.freebsoft.org
> http://lists.freebsoft.org/mailman/listinfo/speechd



reply via email to

[Prev in Thread] Current Thread [Next in Thread]