diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2016-01-09 18:56:02 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2016-01-09 18:56:02 +0200 |
commit | 8b112059a0a1295541b275957377aa41b445e42d (patch) | |
tree | c2741e113288fa0e56e5fc5f9cd5338a737ffc13 /src | |
parent | 3bac84965a1e1515ef1b1448ac559153a4e8ad25 (diff) | |
download | pies-8b112059a0a1295541b275957377aa41b445e42d.tar.gz pies-8b112059a0a1295541b275957377aa41b445e42d.tar.bz2 |
Minor improvements
* src/ctl.c (ctl_open): Return immediately if
control.url is null.
(fun_start): Start sleeping component.
* src/meta1lex.h: Removed.
* src/pies.c (config_parse): Move creation of the default
control.url to main.
Diffstat (limited to 'src')
-rw-r--r-- | src/ctl.c | 10 | ||||
-rw-r--r-- | src/meta1lex.h | 28 | ||||
-rw-r--r-- | src/pies.c | 24 |
3 files changed, 22 insertions, 40 deletions
@@ -1251,6 +1251,9 @@ int ctl_open (void) { int fd; + + if (!control.url) + return 0; fd = create_socket (control.url, SOCK_STREAM, NULL, 077); if (fd == -1) @@ -1877,6 +1880,13 @@ fun_start (struct json_value *result, struct prog *prog) prog->v.p.status = status_enabled; json_object_set_string (result, "status", "OK"); } + else if (prog->v.p.status == status_sleeping) + { + prog->v.p.status = status_enabled; + prog->v.p.failcount = 0; + prog->v.p.timestamp = 0; + json_object_set_string (result, "status", "OK"); + } else { json_object_set_string (result, "status", "ER"); diff --git a/src/meta1lex.h b/src/meta1lex.h deleted file mode 100644 index 451d839..0000000 --- a/src/meta1lex.h +++ /dev/null @@ -1,28 +0,0 @@ -/* This file is part of GNU Pies. - Copyright (C) 2009, 2010, 2011, 2013 Sergey Poznyakoff - - GNU Pies is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - GNU Pies is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNU Pies. If not, see <http://www.gnu.org/licenses/>. */ - -extern size_t meta1_error_count; -extern char *meta1_queue_dir; - -char *meta1_string (const char *str, size_t len); -void meta1_line_add (const char *text, size_t len); -void meta1_line_add_unescape_last (const char *text, size_t len); -void meta1_line_add_unescape_hex (const char *text, size_t len); -void meta1_line_begin (void); -char *meta1_line_finish (); -void meta1_parse_error (const char *fmt, ...); -int meta1_config_parse (const char *name); - @@ -1755,18 +1755,6 @@ config_parse (char const *name) if (grecs_tree_process (tree, pies_keywords)) config_error (); - if (!control.url) - { - char const *str = default_control_url[init_process]; - if (pies_url_create (&control.url, str)) - { - logmsg (LOG_CRIT, _("%s: cannot create control URL: %s"), - str, strerror (errno)); - if (!init_process) - exit (EX_OSERR); - } - } - grecs_tree_free (tree); } @@ -2389,6 +2377,18 @@ main (int argc, char **argv) diag_setup (DIAG_TO_SYSLOG); } + if (!control.url) + { + char const *str = default_control_url[init_process]; + if (pies_url_create (&control.url, str)) + { + logmsg (LOG_CRIT, _("%s: cannot create control URL: %s"), + str, strerror (errno)); + if (!init_process) + exit (EX_OSERR); + } + } + if (init_process) ctl_open (); else |