summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5293f33)
raw | patch | inline | side by side (parent: 5293f33)
author | toni-moreno <toni.moreno@gmail.com> | |
Sat, 24 Jan 2015 06:34:23 +0000 (07:34 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Tue, 1 Dec 2015 15:33:29 +0000 (16:33 +0100) |
src/write_graphite.c | patch | blob | history |
diff --git a/src/write_graphite.c b/src/write_graphite.c
index 836f61907a18071830cb168ef7c1c0bd636a11ab..e65f3d8a4ca822f6966b0f75aed5fdc088945cfc 100644 (file)
--- a/src/write_graphite.c
+++ b/src/write_graphite.c
/*Force reconnect useful for load balanced environments*/
cdtime_t last_force_reconnect_time;
int force_reconnect_timeout;
+ int conn_forced_closed;
};
/*
cb->sock_fd = -1;
INFO("Connection Forced closed after %ld seconds ",CDTIME_T_TO_TIME_T(now - cb->last_force_reconnect_time));
cb->last_force_reconnect_time = now;
+ cb->conn_forced_closed=1;
}
"write_graphite plugin: Successfully connected to %s:%s via %s.",
cb->node, cb->service, cb->protocol);
}
-
- wg_reset_buffer (cb);
-
+ if(!cb->conn_forced_closed || cb->send_buf_free== 0)
+ {
+ /*when not forced connection*/
+ /*or buffer not initialized -- happens if forceReconnect happens before first connection*/
+ wg_reset_buffer (cb);
+ }
+ else {
+ /*if forced connection don't reset buffer with valid metrics when reconnect*/
+ cb->conn_forced_closed=0;
+ }
return (0);
}
cb->protocol = strdup (WG_DEFAULT_PROTOCOL);
cb->last_force_reconnect_time=cdtime();
cb->force_reconnect_timeout=0;
+ cb->conn_forced_closed=0;
cb->log_send_errors = WG_DEFAULT_LOG_SEND_ERRORS;
cb->prefix = NULL;
cb->postfix = NULL;