]> arthur.barton.de Git - netdata.git/commitdiff
proxies disconnect and reconnect to follow the receiving side
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 25 Feb 2017 11:35:11 +0000 (13:35 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 25 Feb 2017 11:35:11 +0000 (13:35 +0200)
src/rrdpush.c

index 0e7f0aedb170fabade8dbe8db6a33bf7f3070c82..729544b5a3155c69edb6b3035b10fae9cfda6b3f 100644 (file)
@@ -211,19 +211,26 @@ void rrdpush_sender_thread_cleanup(RRDHOST *host) {
 
     host->rrdpush_connected = 0;
 
-    if(host->rrdpush_socket != -1) close(host->rrdpush_socket);
+    if(host->rrdpush_socket != -1) {
+        close(host->rrdpush_socket);
+        host->rrdpush_socket = -1;
+    }
 
     // close the pipe
-    if(host->rrdpush_pipe[PIPE_READ] != -1)  close(host->rrdpush_pipe[PIPE_READ]);
-    if(host->rrdpush_pipe[PIPE_WRITE] != -1) close(host->rrdpush_pipe[PIPE_WRITE]);
-    host->rrdpush_pipe[PIPE_READ] = -1;
-    host->rrdpush_pipe[PIPE_WRITE] = -1;
+    if(host->rrdpush_pipe[PIPE_READ] != -1) {
+        close(host->rrdpush_pipe[PIPE_READ]);
+        host->rrdpush_pipe[PIPE_READ] = -1;
+    }
+
+    if(host->rrdpush_pipe[PIPE_WRITE] != -1) {
+        close(host->rrdpush_pipe[PIPE_WRITE]);
+        host->rrdpush_pipe[PIPE_WRITE] = -1;
+    }
 
     buffer_free(host->rrdpush_buffer);
     host->rrdpush_buffer = NULL;
 
     host->rrdpush_spawn = 0;
-    host->rrdpush_enabled = 0;
 
     rrdpush_unlock(host);
 }
@@ -547,7 +554,7 @@ int rrdpush_receive(int fd, const char *key, const char *hostname, const char *m
         if(health_enabled == CONFIG_BOOLEAN_AUTO)
             host->health_enabled = 0;
 
-        if(host->rrdpush_enabled && host->rrdpush_spawn) {
+        if(host->rrdpush_spawn) {
             pthread_cancel(host->rrdpush_thread);
             rrdpush_sender_thread_cleanup(host);
         }