Browse Source

Determine when messages are being sent to ckmsgqs not set up yet

master
Con Kolivas 9 years ago
parent
commit
3dac4d4fc8
  1. 3
      src/ckpool.c
  2. 3
      src/ckpool.h

3
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 /* Generic function for adding messages to a ckmsgq linked list and signal the
* ckmsgq parsing thread(s) to wake up and process it. */ * 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; ckmsg_t *msg;
if (unlikely(!ckmsgq)) { 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 /* Discard data if we're unlucky enough to be sending it to
* msg queues not set up during start up */ * msg queues not set up during start up */
free(data); free(data);

3
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_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); 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); bool ckmsgq_empty(ckmsgq_t *ckmsgq);
unix_msg_t *get_unix_msg(proc_instance_t *pi); unix_msg_t *get_unix_msg(proc_instance_t *pi);

Loading…
Cancel
Save