commit 28d1da0

default  ·  2023-02-11 05:28:36 +0000 UTC
parent f325b56
Don't fail silently if the job fifo is not ready.
3 files changed,  +9, -1
M data.c
M snac.h
M data.c
+1, -1
1@@ -1407,7 +1407,7 @@ void enqueue_output_raw(const char *keyid, const char *seckey,
2     qmsg = xs_dict_append(qmsg, "seckey", seckey);
3 
4     /* if it's to be sent right now, bypass the disk queue and post the job */
5-    if (retries == 0)
6+    if (retries == 0 && job_fifo_ready())
7         job_post(qmsg);
8     else {
9         qmsg = _enqueue_put(fn, qmsg);
+7, -0
 1@@ -251,6 +251,13 @@ static sem_t job_sem;
 2 xs_list *job_fifo = NULL;
 3 
 4 
 5+int job_fifo_ready(void)
 6+/* returns true if the job fifo is ready */
 7+{
 8+    return job_fifo != NULL;
 9+}
10+
11+
12 void job_post(const xs_val *job)
13 /* posts a job for the threads to process it */
14 {
M snac.h
+1, -0
1@@ -207,5 +207,6 @@ int snac_init(const char *_basedir);
2 int adduser(const char *uid);
3 int resetpwd(snac *snac);
4 
5+int job_fifo_ready(void);
6 void job_post(const xs_val *job);
7 void job_wait(xs_val **job);