summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2023-02-11 06:28:36 +0100
committerGravatar default2023-02-11 06:28:36 +0100
commit28d1da0a81f0d07d5960792eddce37b22dd43da7 (patch)
treed04461b1583863ff6c9fd84202dca50c70d1dc70
parentImproved Delete button fix. (diff)
downloadsnac2-28d1da0a81f0d07d5960792eddce37b22dd43da7.tar.gz
snac2-28d1da0a81f0d07d5960792eddce37b22dd43da7.tar.xz
snac2-28d1da0a81f0d07d5960792eddce37b22dd43da7.zip
Don't fail silently if the job fifo is not ready.
-rw-r--r--data.c2
-rw-r--r--httpd.c7
-rw-r--r--snac.h1
3 files changed, 9 insertions, 1 deletions
diff --git a/data.c b/data.c
index a500b03..43fbeef 100644
--- a/data.c
+++ b/data.c
@@ -1407,7 +1407,7 @@ void enqueue_output_raw(const char *keyid, const char *seckey,
1407 qmsg = xs_dict_append(qmsg, "seckey", seckey); 1407 qmsg = xs_dict_append(qmsg, "seckey", seckey);
1408 1408
1409 /* if it's to be sent right now, bypass the disk queue and post the job */ 1409 /* if it's to be sent right now, bypass the disk queue and post the job */
1410 if (retries == 0) 1410 if (retries == 0 && job_fifo_ready())
1411 job_post(qmsg); 1411 job_post(qmsg);
1412 else { 1412 else {
1413 qmsg = _enqueue_put(fn, qmsg); 1413 qmsg = _enqueue_put(fn, qmsg);
diff --git a/httpd.c b/httpd.c
index 1208e84..b952edc 100644
--- a/httpd.c
+++ b/httpd.c
@@ -251,6 +251,13 @@ static sem_t job_sem;
251xs_list *job_fifo = NULL; 251xs_list *job_fifo = NULL;
252 252
253 253
254int job_fifo_ready(void)
255/* returns true if the job fifo is ready */
256{
257 return job_fifo != NULL;
258}
259
260
254void job_post(const xs_val *job) 261void job_post(const xs_val *job)
255/* posts a job for the threads to process it */ 262/* posts a job for the threads to process it */
256{ 263{
diff --git a/snac.h b/snac.h
index 5190f42..1be36cb 100644
--- a/snac.h
+++ b/snac.h
@@ -207,5 +207,6 @@ int snac_init(const char *_basedir);
207int adduser(const char *uid); 207int adduser(const char *uid);
208int resetpwd(snac *snac); 208int resetpwd(snac *snac);
209 209
210int job_fifo_ready(void);
210void job_post(const xs_val *job); 211void job_post(const xs_val *job);
211void job_wait(xs_val **job); 212void job_wait(xs_val **job);