You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2016/03/31 07:38:42 UTC

trafficserver git commit: Minor debug tags cleanup.

Repository: trafficserver
Updated Branches:
  refs/heads/master 8aecddedf -> 5a0952b01


Minor debug tags cleanup.

Consistently use is_debug_tag_set() instead of directly calling
Diags::on(). Add the missing cop_test_page checks for HTTP header
debugging.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/5a0952b0
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/5a0952b0
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/5a0952b0

Branch: refs/heads/master
Commit: 5a0952b01d01ef927a65fc44bac5f68c345747aa
Parents: 8aecdde
Author: James Peach <jp...@apache.org>
Authored: Wed Mar 30 22:29:12 2016 -0700
Committer: James Peach <jp...@apache.org>
Committed: Wed Mar 30 22:29:12 2016 -0700

----------------------------------------------------------------------
 iocore/hostdb/HostDB.cc         |  2 +-
 proxy/InkAPI.cc                 |  6 +++---
 proxy/http/HttpSM.cc            | 10 ++++++++--
 proxy/http/HttpTransact.cc      | 13 +++++++------
 proxy/http/HttpTransactCache.cc |  6 +++---
 5 files changed, 22 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5a0952b0/iocore/hostdb/HostDB.cc
----------------------------------------------------------------------
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 2985016..9966437 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -1190,7 +1190,7 @@ remove_round_robin(HostDBInfo *r, const char *hostname, IpAddr const &ip)
           hostDB.delete_block(r);
           return false;
         } else {
-          if (diags->on("hostdb")) {
+          if (is_debug_tag_set("hostdb")) {
             int bufsize = rr->good * INET6_ADDRSTRLEN;
             char *rr_ip_list = (char *)alloca(bufsize);
             char *p = rr_ip_list;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5a0952b0/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index ee6cc08..4da8f4d 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -6830,13 +6830,13 @@ ink_sanity_check_stat_structure(void *obj)
 int
 TSIsDebugTagSet(const char *t)
 {
-  return (diags->on(t, DiagsTagType_Debug)) ? 1 : 0;
+  return is_debug_tag_set(t);
 }
 
 void
 TSDebugSpecific(int debug_flag, const char *tag, const char *format_str, ...)
 {
-  if (diags->on(tag, DiagsTagType_Debug) || (debug_flag && diags->on())) {
+  if (is_debug_tag_set(tag) || (debug_flag && diags->on())) {
     va_list ap;
 
     va_start(ap, format_str);
@@ -6850,7 +6850,7 @@ TSDebugSpecific(int debug_flag, const char *tag, const char *format_str, ...)
 void
 TSDebug(const char *tag, const char *format_str, ...)
 {
-  if (diags->on(tag, DiagsTagType_Debug)) {
+  if (is_debug_tag_set(tag)) {
     va_list ap;
 
     va_start(ap, format_str);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5a0952b0/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 90ac195..5d58b75 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -5770,7 +5770,11 @@ HttpSM::setup_server_send_request()
     msg_len = t_state.internal_msg_buffer_size;
     t_state.hdr_info.server_request.value_set_int64(MIME_FIELD_CONTENT_LENGTH, MIME_LEN_CONTENT_LENGTH, msg_len);
   }
-  DUMP_HEADER("http_hdrs", &(t_state.hdr_info.server_request), t_state.state_machine_id, "Proxy's Request after hooks");
+
+  if (!t_state.cop_test_page) {
+    DUMP_HEADER("http_hdrs", &(t_state.hdr_info.server_request), t_state.state_machine_id, "Proxy's Request after hooks");
+  }
+
   // We need a reader so bytes don't fall off the end of
   //  the buffer
   IOBufferReader *buf_start = server_entry->write_buffer->alloc_reader();
@@ -7652,7 +7656,9 @@ HttpSM::redirect_request(const char *redirect_url, const int redirect_len)
     }
   }
 
-  DUMP_HEADER("http_hdrs", &t_state.hdr_info.client_request, sm_id, "Framed Client Request..checking");
+  if (!t_state.cop_test_page) {
+    DUMP_HEADER("http_hdrs", &t_state.hdr_info.client_request, sm_id, "Framed Client Request..checking");
+  }
 }
 
 void

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5a0952b0/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 00c1b2c..8a1f536 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -2235,7 +2235,9 @@ HttpTransact::issue_revalidate(State *s)
     // the client has the right credentials
     // this cache action is just to get us into the hcoofsr function
     s->cache_info.action = CACHE_DO_UPDATE;
-    DUMP_HEADER("http_hdrs", &s->hdr_info.server_request, s->state_machine_id, "Proxy's Request (Conditionalized)");
+    if (!s->cop_test_page) {
+      DUMP_HEADER("http_hdrs", &s->hdr_info.server_request, s->state_machine_id, "Proxy's Request (Conditionalized)");
+    }
     return;
   }
 
@@ -7973,13 +7975,12 @@ HttpTransact::build_response(State *s, HTTPHdr *base_response, HTTPHdr *outgoing
   //  s->state_machine->authAdapter.UpdateResponseHeaders(outgoing_response);
   // }
 
-  if (diags->on()) {
+  if (!s->cop_test_page && is_debug_tag_set("http_hdrs")) {
     if (base_response) {
-      if (!s->cop_test_page)
-        DUMP_HEADER("http_hdrs", base_response, s->state_machine_id, "Base Header for Building Response");
+      DUMP_HEADER("http_hdrs", base_response, s->state_machine_id, "Base Header for Building Response");
     }
-    if (!s->cop_test_page)
-      DUMP_HEADER("http_hdrs", outgoing_response, s->state_machine_id, "Proxy's Response 2");
+
+    DUMP_HEADER("http_hdrs", outgoing_response, s->state_machine_id, "Proxy's Response 2");
   }
 
   return;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5a0952b0/proxy/http/HttpTransactCache.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransactCache.cc b/proxy/http/HttpTransactCache.cc
index f666f9f..99063b4 100644
--- a/proxy/http/HttpTransactCache.cc
+++ b/proxy/http/HttpTransactCache.cc
@@ -182,7 +182,7 @@ HttpTransactCache::SelectFromAlternates(CacheHTTPInfoVector *cache_vector, HTTPH
 
   Debug("http_match", "[SelectFromAlternates] # alternates = %d", alt_count);
   Debug("http_seq", "[SelectFromAlternates] %d alternates for this cached doc", alt_count);
-  if (diags->on("http_alts")) {
+  if (is_debug_tag_set("http_alts")) {
     ACQUIRE_PRINT_LOCK()
     fprintf(stderr, "[alts] There are %d alternates for this request header.\n", alt_count);
     RELEASE_PRINT_LOCK()
@@ -225,7 +225,7 @@ HttpTransactCache::SelectFromAlternates(CacheHTTPInfoVector *cache_vector, HTTPH
         current_age = (time_t)0;
       }
 
-      if (diags->on("http_alts")) {
+      if (is_debug_tag_set("http_alts")) {
         fprintf(stderr, "[alts] ---- alternate #%d (Q = %g) has these request/response hdrs:\n", i + 1, Q);
         char b[4096];
         int used, tmp, offset;
@@ -260,7 +260,7 @@ HttpTransactCache::SelectFromAlternates(CacheHTTPInfoVector *cache_vector, HTTPH
     }
   }
   Debug("http_seq", "[SelectFromAlternates] Chosen alternate # %d", best_index);
-  if (diags->on("http_alts")) {
+  if (is_debug_tag_set("http_alts")) {
     ACQUIRE_PRINT_LOCK()
     fprintf(stderr, "[alts] and the winner is alternate number %d\n", best_index + 1);
     RELEASE_PRINT_LOCK()