| 48 | namespace |
| 49 | { |
| 50 | int |
| 51 | handleTimerEvent(TSCont cont, TSEvent /* event ATS_UNUSED */, void * /* edata ATS_UNUSED */) |
| 52 | { |
| 53 | AsyncTimerState *state = static_cast<AsyncTimerState *>(TSContDataGet(cont)); |
| 54 | if (state->initial_timer_action_) { |
| 55 | LOG_DEBUG("Received initial timer event."); |
| 56 | state->initial_timer_action_ = nullptr; // mark it so that it won't be canceled later on |
| 57 | if (state->type_ == AsyncTimer::TYPE_PERIODIC) { |
| 58 | LOG_DEBUG("Scheduling periodic event now"); |
| 59 | state->periodic_timer_action_ = TSContScheduleEveryOnPool(state->cont_, state->period_in_ms_, state->thread_pool_); |
| 60 | } |
| 61 | } |
| 62 | if (!state->dispatch_controller_->dispatch()) { |
| 63 | LOG_DEBUG("Receiver has died. Destroying timer"); |
| 64 | delete state->timer_; // auto-destruct only in this case |
| 65 | } |
| 66 | return 0; |
| 67 | } |
| 68 | } // namespace |
| 69 | |
| 70 | AsyncTimer::AsyncTimer(Type type, int period_in_ms, int initial_period_in_ms, TSThreadPool thread_pool) |
nothing calls this directly
no test coverage detected