| 555 | } |
| 556 | |
| 557 | static int |
| 558 | config_handler(TSCont cont, TSEvent event, void * /* edata ATS_UNUSED */) |
| 559 | { |
| 560 | plugin_state_t *pstate; |
| 561 | invalidate_t *i, *iptr; |
| 562 | TSCont free_cont; |
| 563 | bool updated; |
| 564 | TSMutex mutex; |
| 565 | |
| 566 | Dbg(dbg_ctl, "In config_handler"); |
| 567 | |
| 568 | mutex = TSContMutexGet(cont); |
| 569 | TSMutexLock(mutex); |
| 570 | |
| 571 | pstate = (plugin_state_t *)TSContDataGet(cont); |
| 572 | i = copy_config(pstate->invalidate_list); |
| 573 | |
| 574 | updated = prune_config(&i); |
| 575 | updated = load_config(pstate, &i) || updated; |
| 576 | |
| 577 | if (updated) { |
| 578 | list_config(pstate, i); |
| 579 | iptr = __sync_val_compare_and_swap(&(pstate->invalidate_list), pstate->invalidate_list, i); |
| 580 | |
| 581 | if (iptr) { |
| 582 | free_cont = TSContCreate(free_handler, TSMutexCreate()); |
| 583 | TSContDataSet(free_cont, (void *)iptr); |
| 584 | TSContScheduleOnPool(free_cont, FREE_TMOUT, TS_THREAD_POOL_TASK); |
| 585 | } |
| 586 | } else { |
| 587 | Dbg(dbg_ctl, "No Changes"); |
| 588 | if (i) { |
| 589 | free_invalidate_t_list(i); |
| 590 | } |
| 591 | } |
| 592 | |
| 593 | TSMutexUnlock(mutex); |
| 594 | |
| 595 | // Don't reschedule for TS_EVENT_MGMT_UPDATE |
| 596 | if (event == TS_EVENT_TIMEOUT) { |
| 597 | TSContScheduleOnPool(cont, CONFIG_TMOUT, TS_THREAD_POOL_TASK); |
| 598 | } |
| 599 | return 0; |
| 600 | } |
| 601 | |
| 602 | static time_t |
| 603 | get_date_from_cached_hdr(TSHttpTxn txn) |
nothing calls this directly
no test coverage detected