summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 994f35f)
raw | patch | inline | side by side (parent: 994f35f)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Mon, 6 Nov 2006 18:34:53 +0000 (19:34 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Mon, 6 Nov 2006 18:34:53 +0000 (19:34 +0100) |
Lubos Stanek has reported that the daemon may stop too slow, resulting in it
being killed by impatient init-scripts. With this patch `plugin_read_all'
checks the `loop' variable before entering each plugin's read-function. If the
loop-variable is set to non-zero it will return early, allowing the daemon to
shutdown more instantly.
being killed by impatient init-scripts. With this patch `plugin_read_all'
checks the `loop' variable before entering each plugin's read-function. If the
loop-variable is set to non-zero it will return early, allowing the daemon to
shutdown more instantly.
src/collectd.c | patch | blob | history | |
src/plugin.c | patch | blob | history | |
src/plugin.h | patch | blob | history |
diff --git a/src/collectd.c b/src/collectd.c
index 98b9a1623f77b8840e6dbf36dbd7cfa4c69b2f1e..ef2ccc75eca2bee5da721b5d2e2ba80132bda9f8 100644 (file)
--- a/src/collectd.c
+++ b/src/collectd.c
curtime = time (NULL);
/* Issue all plugins */
- plugin_read_all ();
+ plugin_read_all (&loop);
if (gettimeofday (&tv_now, NULL) < 0)
{
diff --git a/src/plugin.c b/src/plugin.c
index be28671a7cb7b5efae25d14db22b5fd8c2713e3b..697449e209e81a8791e50bd8cfeb8f93711307e4 100644 (file)
--- a/src/plugin.c
+++ b/src/plugin.c
/*
* Call `read' on all plugins (if given)
*/
-void plugin_read_all (void)
+void plugin_read_all (const int *loop)
{
plugin_t *p;
- for (p = first_plugin; p != NULL; p = p->next)
+ for (p = first_plugin; (*loop == 0) && (p != NULL); p = p->next)
if (p->read != NULL)
(*p->read) ();
}
diff --git a/src/plugin.h b/src/plugin.h
index e1e2e7cfa2e8c889e23e193c341574550fadb3b8..a77c87fb9a39be0ac298be5746a86cdf9f30fbb6 100644 (file)
--- a/src/plugin.h
+++ b/src/plugin.h
int plugin_load_all (char *dir);
void plugin_init_all (void);
-void plugin_read_all (void);
+void plugin_read_all (const int *loop);
void plugin_register (char *type,
void (*init) (void),