| 2655 | } |
| 2656 | |
| 2657 | int |
| 2658 | HttpSM::main_handler(int event, void *data) |
| 2659 | { |
| 2660 | ink_release_assert(magic == HTTP_SM_MAGIC_ALIVE); |
| 2661 | |
| 2662 | HttpSMHandler jump_point = nullptr; |
| 2663 | ink_assert(reentrancy_count >= 0); |
| 2664 | reentrancy_count++; |
| 2665 | |
| 2666 | // Don't use the state enter macro since it uses history |
| 2667 | // space that we don't care about |
| 2668 | SMDbg(dbg_ctl_http, "%s, %d", HttpDebugNames::get_event_name(event), event); |
| 2669 | |
| 2670 | HttpVCTableEntry *vc_entry = nullptr; |
| 2671 | |
| 2672 | if (data != nullptr) { |
| 2673 | // Only search the VC table if the event could have to |
| 2674 | // do with a VIO to save a few cycles |
| 2675 | |
| 2676 | if (event < VC_EVENT_EVENTS_START + 100) { |
| 2677 | vc_entry = vc_table.find_entry(static_cast<VIO *>(data)); |
| 2678 | } |
| 2679 | } |
| 2680 | |
| 2681 | if (vc_entry) { |
| 2682 | jump_point = (static_cast<VIO *>(data) == vc_entry->read_vio) ? vc_entry->vc_read_handler : vc_entry->vc_write_handler; |
| 2683 | ink_assert(jump_point != (HttpSMHandler) nullptr); |
| 2684 | ink_assert(vc_entry->vc != (VConnection *)nullptr); |
| 2685 | (this->*jump_point)(event, data); |
| 2686 | } else { |
| 2687 | ink_assert(default_handler != (HttpSMHandler) nullptr); |
| 2688 | (this->*default_handler)(event, data); |
| 2689 | } |
| 2690 | |
| 2691 | // The sub-handler signals when it is time for the state |
| 2692 | // machine to exit. We can only exit if we are not reentrantly |
| 2693 | // called otherwise when the our call unwinds, we will be |
| 2694 | // running on a dead state machine |
| 2695 | // |
| 2696 | // Because of the need for an api shutdown hook, kill_this() |
| 2697 | // is also reentrant. As such, we don't want to decrement |
| 2698 | // the reentrancy count until after we run kill_this() |
| 2699 | // |
| 2700 | if (terminate_sm == true && reentrancy_count == 1) { |
| 2701 | kill_this(); |
| 2702 | } else { |
| 2703 | reentrancy_count--; |
| 2704 | ink_assert(reentrancy_count >= 0); |
| 2705 | } |
| 2706 | |
| 2707 | return (VC_EVENT_CONT); |
| 2708 | } |
| 2709 | |
| 2710 | // void HttpSM::tunnel_handler_post_or_put() |
| 2711 | // |
nothing calls this directly
no test coverage detected