///////////////////////////////////////////////////////////////////// HttpSM::kill_this() This function has two phases. One before we call the asynchronous clean up routines (api and list removal) and one after. The state about which phase we are in is kept in HttpSM::kill_this_async_done /////////////////////////////////////////////////////////////////////
| 7502 | // |
| 7503 | ////////////////////////////////////////////////////////////////////////// |
| 7504 | void |
| 7505 | HttpSM::kill_this() |
| 7506 | { |
| 7507 | ink_release_assert(reentrancy_count == 1); |
| 7508 | this->postbuf_clear(); |
| 7509 | enable_redirection = false; |
| 7510 | |
| 7511 | if (kill_this_async_done == false) { |
| 7512 | //////////////////////////////// |
| 7513 | // cancel uncompleted actions // |
| 7514 | //////////////////////////////// |
| 7515 | // The action should be cancelled only if |
| 7516 | // the state machine is in HTTP_API_NO_CALLOUT |
| 7517 | // state. This is because we are depending on the |
| 7518 | // callout to complete for the state machine to |
| 7519 | // get killed. |
| 7520 | if (callout_state == HTTP_API_NO_CALLOUT && !pending_action.empty()) { |
| 7521 | pending_action = nullptr; |
| 7522 | } else if (!pending_action.empty()) { |
| 7523 | ink_assert(pending_action.empty()); |
| 7524 | } |
| 7525 | |
| 7526 | cache_sm.end_both(); |
| 7527 | transform_cache_sm.end_both(); |
| 7528 | vc_table.cleanup_all(); |
| 7529 | |
| 7530 | // Clean up the tunnel resources. Take |
| 7531 | // it down if it is still active |
| 7532 | tunnel.kill_tunnel(); |
| 7533 | |
| 7534 | if (_netvc) { |
| 7535 | _netvc->do_io_close(); |
| 7536 | free_MIOBuffer(_netvc_read_buffer); |
| 7537 | } else if (server_txn == nullptr) { |
| 7538 | this->cancel_pending_server_connection(); |
| 7539 | } |
| 7540 | |
| 7541 | // It possible that a plugin added transform hook |
| 7542 | // but the hook never executed due to a client abort |
| 7543 | // In that case, we need to manually close all the |
| 7544 | // transforms to prevent memory leaks (INKqa06147) |
| 7545 | if (hooks_set) { |
| 7546 | transform_cleanup(TS_HTTP_RESPONSE_TRANSFORM_HOOK, &transform_info); |
| 7547 | transform_cleanup(TS_HTTP_REQUEST_TRANSFORM_HOOK, &post_transform_info); |
| 7548 | plugin_agents_cleanup(); |
| 7549 | } |
| 7550 | // It's also possible that the plugin_tunnel vc was never |
| 7551 | // executed due to not contacting the server |
| 7552 | if (plugin_tunnel) { |
| 7553 | plugin_tunnel->kill_no_connect(); |
| 7554 | plugin_tunnel = nullptr; |
| 7555 | } |
| 7556 | |
| 7557 | // So we don't try to nuke the state machine |
| 7558 | // if the plugin receives event we must reset |
| 7559 | // the terminate_flag |
| 7560 | terminate_sm = false; |
| 7561 | t_state.api_next_action = HttpTransact::SM_ACTION_API_SM_SHUTDOWN; |
nothing calls this directly
no test coverage detected