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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 736ef12  avoid dynamic_cast to get Pi-tag for non_internal requests 
(#6868)
736ef12 is described below

commit 736ef125df037192210ac6a16e8b3f3662053ce4
Author: Sudheer Vinukonda <sudhe...@apache.org>
AuthorDate: Tue Jun 9 14:28:53 2020 -0700

    avoid dynamic_cast to get Pi-tag for non_internal requests (#6868)
    
    Optimization - See lots of stack traces spending cycles on dynamic_cast
    for every request, when in reality, it's no longer needed as 
Http2ClientSession which
    used to inherit PluginIdentity in the past is no longer doing that and
    the client access protocol for access logs is being extracted directly
    from the HttpSM context.
    
    (cherry picked from commit fd4e8186ae51582e75d8f88f71366d1150cd0d82)
---
 proxy/ProxyTransaction.cc | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/proxy/ProxyTransaction.cc b/proxy/ProxyTransaction.cc
index 23eeb08..9be892f 100644
--- a/proxy/ProxyTransaction.cc
+++ b/proxy/ProxyTransaction.cc
@@ -43,10 +43,13 @@ ProxyTransaction::new_transaction(bool from_early_data)
   HttpTxnDebug("[%" PRId64 "] Starting transaction %d using sm [%" PRId64 "]", 
_proxy_ssn->connection_id(),
                _proxy_ssn->get_transact_count(), _sm->sm_id);
 
-  PluginIdentity *pi = dynamic_cast<PluginIdentity *>(this->get_netvc());
-  if (pi) {
-    _sm->plugin_tag = pi->getPluginTag();
-    _sm->plugin_id  = pi->getPluginId();
+  // PI tag valid only for internal requests
+  if (this->get_netvc()->get_is_internal_request()) {
+    PluginIdentity *pi = dynamic_cast<PluginIdentity *>(this->get_netvc());
+    if (pi) {
+      _sm->plugin_tag = pi->getPluginTag();
+      _sm->plugin_id  = pi->getPluginId();
+    }
   }
 
   this->increment_client_transactions_stat();

Reply via email to