author | Florian Forster <octo@collectd.org> | |
Fri, 7 Oct 2016 06:51:29 +0000 (08:51 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Fri, 7 Oct 2016 06:51:29 +0000 (08:51 +0200) |
1 | 2 | |||
---|---|---|---|---|
contrib/examples/myplugin.c | patch | | diff1 | | diff2 | | blob | history |
src/daemon/common.c | patch | | diff1 | | diff2 | | blob | history |
src/rrdcached.c | patch | | diff1 | | diff2 | | blob | history |
src/vserver.c | patch | | diff1 | | diff2 | | blob | history |
diff --cc contrib/examples/myplugin.c
Simple merge
diff --cc src/daemon/common.c
Simple merge
diff --cc src/rrdcached.c
index 0425419445d738a6e80992c77c51b229112ca173,42fd3a34414969b139d8b0086c3016ebd7603f7b..0b9040536ecc165f0b9a85ea7bacd1d5866358d6
--- 1/src/rrdcached.c
--- 2/src/rrdcached.c
+++ b/src/rrdcached.c
{
int status;
rrdc_stats_t *head;
- rrdc_stats_t *ptr;
+ _Bool retried = 0;
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
return (-1);
}
- head = NULL;
- status = rrdc_stats_get (&head);
- if (status != 0)
+ while (42)
{
- ERROR ("rrdcached plugin: rrdc_stats_get failed with status %i.", status);
+ /* The RRD client lib does not provide any means for checking a
+ * connection, hence we'll have to retry upon failed operations. */
+ head = NULL;
+ rrd_clear_error ();
+ status = rrdc_stats_get (&head);
+ if (status == 0)
+ break;
+
- if (! retried)
++ if (!retried)
+ {
+ retried = 1;
+ if (try_reconnect () == 0)
+ continue;
+ /* else: report the error and fail */
+ }
+
+ ERROR ("rrdcached plugin: rrdc_stats_get failed: %s (status=%i).",
+ rrd_get_error (), status);
return (-1);
}
return (-1);
}
- status = rrdc_update (filename, /* values_num = */ 1, (void *) values_array);
- if (status != 0)
+ while (42)
{
- ERROR ("rrdcached plugin: rrdc_update (%s, [%s], 1) failed with "
- "status %i.",
- filename, values_array[0], status);
+ /* The RRD client lib does not provide any means for checking a
+ * connection, hence we'll have to retry upon failed operations. */
+ rrd_clear_error ();
+ status = rrdc_update (filename, /* values_num = */ 1, (void *) values_array);
+ if (status == 0)
+ break;
+
- if (! retried)
++ if (!retried)
+ {
+ retried = 1;
+ if (try_reconnect () == 0)
+ continue;
+ /* else: report the error and fail */
+ }
+
+ ERROR ("rrdcached plugin: rrdc_update (%s, [%s], 1) failed: %s (status=%i)",
+ filename, values_array[0], rrd_get_error (), status);
return (-1);
}
return (-1);
}
- status = rrdc_flush (filename);
- if (status != 0)
+ while (42)
{
- ERROR ("rrdcached plugin: rrdc_flush (%s) failed with status %i.",
- filename, status);
+ /* The RRD client lib does not provide any means for checking a
+ * connection, hence we'll have to retry upon failed operations. */
+ rrd_clear_error ();
+ status = rrdc_flush (filename);
+ if (status == 0)
+ break;
+
- if (! retried)
++ if (!retried)
+ {
+ retried = 1;
+ if (try_reconnect () == 0)
+ continue;
+ /* else: report the error and fail */
+ }
+
+ ERROR ("rrdcached plugin: rrdc_flush (%s) failed: %s (status=%i).",
+ filename, rrd_get_error (), status);
return (-1);
}
DEBUG ("rrdcached plugin: rrdc_flush (%s): Success.", filename);
diff --cc src/vserver.c
Simple merge