From 3dac4d4fc8026feaf2f473085626860b16a8f7d7 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sat, 27 Feb 2016 09:16:21 +1100 Subject: [PATCH] Determine when messages are being sent to ckmsgqs not set up yet --- src/ckpool.c | 3 ++- src/ckpool.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ckpool.c b/src/ckpool.c index daa9b034..0ee16a78 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -180,11 +180,12 @@ ckmsgq_t *create_ckmsgqs(ckpool_t *ckp, const char *name, const void *func, cons /* Generic function for adding messages to a ckmsgq linked list and signal the * ckmsgq parsing thread(s) to wake up and process it. */ -void ckmsgq_add(ckmsgq_t *ckmsgq, void *data) +void _ckmsgq_add(ckmsgq_t *ckmsgq, void *data, const char *file, const char *func, const int line) { ckmsg_t *msg; if (unlikely(!ckmsgq)) { + LOGWARNING("Sending messages to no queue from %s %s:%d", file, func, line); /* Discard data if we're unlucky enough to be sending it to * msg queues not set up during start up */ free(data); diff --git a/src/ckpool.h b/src/ckpool.h index 6877bad5..66297959 100644 --- a/src/ckpool.h +++ b/src/ckpool.h @@ -315,7 +315,8 @@ static const char __maybe_unused *stratum_msgs[] = { ckmsgq_t *create_ckmsgq(ckpool_t *ckp, const char *name, const void *func); ckmsgq_t *create_ckmsgqs(ckpool_t *ckp, const char *name, const void *func, const int count); -void ckmsgq_add(ckmsgq_t *ckmsgq, void *data); +void _ckmsgq_add(ckmsgq_t *ckmsgq, void *data, const char *file, const char *func, const int line); +#define ckmsgq_add(ckmsgq, data) _ckmsgq_add(ckmsgq, data, __FILE__, __func__, __LINE__) bool ckmsgq_empty(ckmsgq_t *ckmsgq); unix_msg_t *get_unix_msg(proc_instance_t *pi);