+ return default_rrdpush_enabled;
+}
+
+static inline void rrdpush_sender_lock(RRDHOST *host) {
+ if(pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL) != 0)
+ error("STREAM [send]: cannot set pthread cancel state to DISABLE.");
+
+ rrdpush_lock(host);
+}
+
+static inline void rrdpush_sender_unlock(RRDHOST *host) {
+ if(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) != 0)
+ error("STREAM [send]: cannot set pthread cancel state to DISABLE.");
+
+ rrdpush_unlock(host);
+}
+
+void rrdpush_sender_cleanup(RRDHOST *host) {
+ rrdpush_lock(host);
+
+ host->rrdpush_connected = 0;
+
+ if(host->rrdpush_socket != -1) close(host->rrdpush_socket);
+
+ // 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;
+
+ buffer_free(host->rrdpush_buffer);
+ host->rrdpush_buffer = NULL;
+
+ host->rrdpush_spawn = 0;
+ host->rrdpush_enabled = 0;
+
+ rrdpush_unlock(host);