MCPcopy Create free account
hub / github.com/apache/httpd / md_status_take_stock

Function md_status_take_stock

modules/md/md_status.c:501–540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

499}
500
501void md_status_take_stock(md_json_t **pjson, apr_array_header_t *mds,
502 md_reg_t *reg, apr_pool_t *p)
503{
504 const md_t *md;
505 md_job_t *job;
506 int i, complete, renewing, errored, ready, total;
507 md_json_t *json;
508
509 json = md_json_create(p);
510 complete = renewing = errored = ready = total = 0;
511 for (i = 0; i < mds->nelts; ++i) {
512 md = APR_ARRAY_IDX(mds, i, const md_t *);
513 ++total;
514 switch (md->state) {
515 case MD_S_COMPLETE: ++complete; /* fall through */
516 case MD_S_INCOMPLETE:
517 if (md_reg_should_renew(reg, md, p)) {
518 ++renewing;
519 job = md_reg_job_make(reg, md->name, p);
520 if (APR_SUCCESS == md_job_load(job)) {
521 if (job->error_runs > 0
522 || (job->last_result && job->last_result->status != APR_SUCCESS)) {
523 ++errored;
524 }
525 else if (job->finished) {
526 ++ready;
527 }
528 }
529 }
530 break;
531 default: ++errored; break;
532 }
533 }
534 md_json_setl(total, json, MD_KEY_TOTAL, NULL);
535 md_json_setl(complete, json, MD_KEY_COMPLETE, NULL);
536 md_json_setl(renewing, json, MD_KEY_RENEWING, NULL);
537 md_json_setl(errored, json, MD_KEY_ERRORED, NULL);
538 md_json_setl(ready, json, MD_KEY_READY, NULL);
539 *pjson = json;
540}
541
542typedef struct {
543 apr_pool_t *p;

Callers 1

md_domains_status_hookFunction · 0.85

Calls 5

md_json_createFunction · 0.85
md_reg_should_renewFunction · 0.85
md_reg_job_makeFunction · 0.85
md_job_loadFunction · 0.85
md_json_setlFunction · 0.85

Tested by

no test coverage detected