This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch NewAPIMetricsPOC
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit e872a0f3e665dcfa2c03a226899818c9a0506cdb
Author: Brian Neradt <[email protected]>
AuthorDate: Fri Jul 7 13:40:29 2023 -0500

    Remove the useless std::vector calls in plugin_agents_cleanup. (#9972)
    
    @maskit observed that there is an unneccesary use of vectors in
    HttpSM::plugin_agents_cleanup. I had in mind using the vector to reduce
    the duplicated logic across the request/response hooks, but that never
    got implemented and using that doesn't add much value, if any. I'll
    simply remove the use of the vectors to simplify the code.
---
 proxy/http/HttpSM.cc | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 77be42d3d5..af3a5167ad 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -7421,25 +7421,19 @@ HttpSM::plugin_agents_cleanup()
   // the VC table and cleaned up there. This handles the case where
   // something went wrong early.
   if (!has_active_response_plugin_agents) {
-    std::vector<APIHook *> agent_lists;
-    agent_lists.push_back(txn_hook_get(TS_HTTP_RESPONSE_CLIENT_HOOK));
-    for (auto &agent : agent_lists) {
-      while (agent) {
-        INKVConnInternal *contp = static_cast<INKVConnInternal 
*>(agent->m_cont);
-        contp->do_io_close();
-        agent = agent->next();
-      }
+    APIHook *agent = txn_hook_get(TS_HTTP_RESPONSE_CLIENT_HOOK);
+    while (agent) {
+      INKVConnInternal *contp = static_cast<INKVConnInternal *>(agent->m_cont);
+      contp->do_io_close();
+      agent = agent->next();
     }
   }
   if (!has_active_request_plugin_agents) {
-    std::vector<APIHook *> agent_lists;
-    agent_lists.push_back(txn_hook_get(TS_HTTP_REQUEST_CLIENT_HOOK));
-    for (auto &agent : agent_lists) {
-      while (agent) {
-        INKVConnInternal *contp = static_cast<INKVConnInternal 
*>(agent->m_cont);
-        contp->do_io_close();
-        agent = agent->next();
-      }
+    APIHook *agent = txn_hook_get(TS_HTTP_REQUEST_CLIENT_HOOK);
+    while (agent) {
+      INKVConnInternal *contp = static_cast<INKVConnInternal *>(agent->m_cont);
+      contp->do_io_close();
+      agent = agent->next();
     }
   }
 }

Reply via email to