proxies disconnect and reconnect to follow the receiving side
Costa Tsaousis (ktsaou) committed
Feb 25, 2017 at 13:35 UTC
38ebad296fa94b9e1e481b4f2a542034dbeebb96
1 file changed
+14
-7
src/rrdpush.c
+14
-7
@@ -211,19 +211,26 @@ void rrdpush_sender_thread_cleanup(RRDHOST *host) {
211
212
host->rrdpush_connected = 0;
213
214
- if(host->rrdpush_socket != -1) close(host->rrdpush_socket);
214
+ if(host->rrdpush_socket != -1) {
215
+ close(host->rrdpush_socket);
216
+ host->rrdpush_socket = -1;
217
+ }
218
219
// close the pipe
217
- if(host->rrdpush_pipe[PIPE_READ] != -1) close(host->rrdpush_pipe[PIPE_READ]);
218
- if(host->rrdpush_pipe[PIPE_WRITE] != -1) close(host->rrdpush_pipe[PIPE_WRITE]);
219
- host->rrdpush_pipe[PIPE_READ] = -1;
220
- host->rrdpush_pipe[PIPE_WRITE] = -1;
220
+ if(host->rrdpush_pipe[PIPE_READ] != -1) {
221
+ close(host->rrdpush_pipe[PIPE_READ]);
222
+ host->rrdpush_pipe[PIPE_READ] = -1;
223
+ }
224
+
225
+ if(host->rrdpush_pipe[PIPE_WRITE] != -1) {
226
+ close(host->rrdpush_pipe[PIPE_WRITE]);
227
+ host->rrdpush_pipe[PIPE_WRITE] = -1;
228
+ }
229
230
buffer_free(host->rrdpush_buffer);
231
host->rrdpush_buffer = NULL;
232
233
host->rrdpush_spawn = 0;
226
- host->rrdpush_enabled = 0;
234
235
rrdpush_unlock(host);
236
}
@@ -547,7 +554,7 @@ int rrdpush_receive(int fd, const char *key, const char *hostname, const char *m
554
if(health_enabled == CONFIG_BOOLEAN_AUTO)
555
host->health_enabled = 0;
556
550
- if(host->rrdpush_enabled && host->rrdpush_spawn) {
557
+ if(host->rrdpush_spawn) {
558
pthread_cancel(host->rrdpush_thread);
559
rrdpush_sender_thread_cleanup(host);
560
}