JCR_free_HANDLER *daemon_free_jcr; /* Local free routine */
dlist *msg_queue; /* Queued messages */
pthread_mutex_t msg_queue_mutex; /* message queue mutex */
+ bool dequeuing_msgs; /* Set when dequeuing messages */
alist job_end_push; /* Job end pushed calls */
POOLMEM *VolumeName; /* Volume name desired -- pool_memory */
POOLMEM *errmsg; /* edited error message */
/* jcr==NULL => daemon message, safe to send now */
Jmsg(jcr, item->type, item->mtime, "%s", item->msg);
free(item);
+ /*
+ * If we are dequeuing, we cannot queue another item,
+ * so as a last resort send it to the syslog
+ */
+ } else if (jcr->dequeuing_msgs) {
+ syslog(LOG_DAEMON|LOG_ERR, "%s", item->msg);
+ free(item);
} else {
/* Queue message for later sending */
P(jcr->msg_queue_mutex);
return;
}
P(jcr->msg_queue_mutex);
+ jcr->dequeuing_msgs = true;
foreach_dlist(item, jcr->msg_queue) {
Jmsg(jcr, item->type, item->mtime, "%s", item->msg);
}
/* Remove messages just sent */
jcr->msg_queue->destroy();
+ jcr->dequeuing_msgs = false;
V(jcr->msg_queue_mutex);
}