diff options
| author | 2023-02-11 06:28:36 +0100 | |
|---|---|---|
| committer | 2023-02-11 06:28:36 +0100 | |
| commit | 28d1da0a81f0d07d5960792eddce37b22dd43da7 (patch) | |
| tree | d04461b1583863ff6c9fd84202dca50c70d1dc70 | |
| parent | Improved Delete button fix. (diff) | |
| download | snac2-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.c | 2 | ||||
| -rw-r--r-- | httpd.c | 7 | ||||
| -rw-r--r-- | snac.h | 1 |
3 files changed, 9 insertions, 1 deletions
| @@ -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); |
| @@ -251,6 +251,13 @@ static sem_t job_sem; | |||
| 251 | xs_list *job_fifo = NULL; | 251 | xs_list *job_fifo = NULL; |
| 252 | 252 | ||
| 253 | 253 | ||
| 254 | int job_fifo_ready(void) | ||
| 255 | /* returns true if the job fifo is ready */ | ||
| 256 | { | ||
| 257 | return job_fifo != NULL; | ||
| 258 | } | ||
| 259 | |||
| 260 | |||
| 254 | void job_post(const xs_val *job) | 261 | void 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 | { |
| @@ -207,5 +207,6 @@ int snac_init(const char *_basedir); | |||
| 207 | int adduser(const char *uid); | 207 | int adduser(const char *uid); |
| 208 | int resetpwd(snac *snac); | 208 | int resetpwd(snac *snac); |
| 209 | 209 | ||
| 210 | int job_fifo_ready(void); | ||
| 210 | void job_post(const xs_val *job); | 211 | void job_post(const xs_val *job); |
| 211 | void job_wait(xs_val **job); | 212 | void job_wait(xs_val **job); |