|
@@ -11,10 +11,12 @@ static void rrdpush_receiver_thread_cleanup(void *ptr) {
|
|
|
struct receiver_state *rpt = (struct receiver_state *) ptr;
|
|
|
|
|
|
// Make sure that we detach this thread and don't kill a freshly arriving receiver
|
|
|
- netdata_mutex_lock(&rpt->host->receiver_lock);
|
|
|
- if (rpt->host->receiver == rpt)
|
|
|
- rpt->host->receiver = NULL;
|
|
|
- netdata_mutex_unlock(&rpt->host->receiver_lock);
|
|
|
+ if (rpt->host) {
|
|
|
+ netdata_mutex_lock(&rpt->host->receiver_lock);
|
|
|
+ if (rpt->host->receiver == rpt)
|
|
|
+ rpt->host->receiver = NULL;
|
|
|
+ netdata_mutex_unlock(&rpt->host->receiver_lock);
|
|
|
+ }
|
|
|
|
|
|
info("STREAM %s [receive from [%s]:%s]: receive thread ended (task id %d)", rpt->hostname, rpt->client_ip, rpt->client_port, gettid());
|
|
|
|