trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject [trafficserver] 01/02: Modify TSHttpTxnHookAdd to add hook only once
Date Wed, 18 Jan 2017 22:33:52 GMT
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 6e6607a2d4a1d792f402e6012a1cf816f1e34657
Author: Meera Mosale Nataraja <mechins@gmail.com>
AuthorDate: Tue Nov 1 13:32:56 2016 -0700

    Modify TSHttpTxnHookAdd to add hook only once
    
    Change-Id: I45c9cdbe305e8b3d186beafb87ab5f8c5b03b757
---
 proxy/InkAPI.cc | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 6cc2770..79cf0c0 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -4613,6 +4613,15 @@ TSHttpTxnHookAdd(TSHttpTxn txnp, TSHttpHookID id, TSCont contp)
   sdk_assert(sdk_sanity_check_hook_id(id) == TS_SUCCESS);
 
   HttpSM *sm = (HttpSM *)txnp;
+  APIHook *hook = sm->txn_hook_get(id);
+
+  // Traverse list of hooks and add a particular hook only once
+  while (hook != NULL) {
+    if (hook->m_cont == (INKContInternal *)contp) {
+      return;
+    }
+    hook = hook->m_link.next;
+  }
   sm->txn_hook_append(id, (INKContInternal *)contp);
 }
 

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.

Mime
View raw message