diff options
Diffstat (limited to 'httpd.c')
| -rw-r--r-- | httpd.c | 29 |
1 files changed, 17 insertions, 12 deletions
| @@ -32,6 +32,18 @@ int srv_running = 0; | |||
| 32 | 32 | ||
| 33 | time_t srv_start_time = 0; | 33 | time_t srv_start_time = 0; |
| 34 | 34 | ||
| 35 | /** job control **/ | ||
| 36 | |||
| 37 | /* mutex to access the lists of jobs */ | ||
| 38 | static pthread_mutex_t job_mutex; | ||
| 39 | |||
| 40 | /* semaphre to trigger job processing */ | ||
| 41 | static sem_t *job_sem; | ||
| 42 | |||
| 43 | /* fifo of jobs */ | ||
| 44 | xs_list *job_fifo = NULL; | ||
| 45 | |||
| 46 | |||
| 35 | /* nodeinfo 2.0 template */ | 47 | /* nodeinfo 2.0 template */ |
| 36 | const char *nodeinfo_2_0_template = "" | 48 | const char *nodeinfo_2_0_template = "" |
| 37 | "{\"version\":\"2.0\"," | 49 | "{\"version\":\"2.0\"," |
| @@ -219,6 +231,11 @@ int server_get_handler(xs_dict *req, const char *q_path, | |||
| 219 | 231 | ||
| 220 | xs *uptime = xs_str_time_diff(time(NULL) - srv_start_time); | 232 | xs *uptime = xs_str_time_diff(time(NULL) - srv_start_time); |
| 221 | srv_log(xs_fmt("status: uptime: %s", uptime)); | 233 | srv_log(xs_fmt("status: uptime: %s", uptime)); |
| 234 | |||
| 235 | pthread_mutex_lock(&job_mutex); | ||
| 236 | int l = xs_list_len(job_fifo); | ||
| 237 | pthread_mutex_unlock(&job_mutex); | ||
| 238 | srv_log(xs_fmt("status: job_fifo len: %d", l)); | ||
| 222 | } | 239 | } |
| 223 | 240 | ||
| 224 | if (status != 0) | 241 | if (status != 0) |
| @@ -417,18 +434,6 @@ void term_handler(int s) | |||
| 417 | } | 434 | } |
| 418 | 435 | ||
| 419 | 436 | ||
| 420 | /** job control **/ | ||
| 421 | |||
| 422 | /* mutex to access the lists of jobs */ | ||
| 423 | static pthread_mutex_t job_mutex; | ||
| 424 | |||
| 425 | /* semaphre to trigger job processing */ | ||
| 426 | static sem_t *job_sem; | ||
| 427 | |||
| 428 | /* fifo of jobs */ | ||
| 429 | xs_list *job_fifo = NULL; | ||
| 430 | |||
| 431 | |||
| 432 | int job_fifo_ready(void) | 437 | int job_fifo_ready(void) |
| 433 | /* returns true if the job fifo is ready */ | 438 | /* returns true if the job fifo is ready */ |
| 434 | { | 439 | { |