You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2015/12/28 21:10:05 UTC

trafficserver git commit: TS-4094: Clean up RD data in RequestData. This close #396.

Repository: trafficserver
Updated Branches:
  refs/heads/master 894ef7f85 -> 2f6be7917


TS-4094: Clean up RD data in RequestData.
This close #396.


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

Branch: refs/heads/master
Commit: 2f6be7917caa5f284d4c918ed819ccf59ea364cd
Parents: 894ef7f
Author: Alan M. Carroll <am...@apache.org>
Authored: Mon Dec 21 18:49:08 2015 -0600
Committer: Alan M. Carroll <am...@apache.org>
Committed: Mon Dec 28 13:57:18 2015 -0600

----------------------------------------------------------------------
 proxy/ControlMatcher.h      | 11 -----------
 proxy/congest/Congestion.cc | 16 ++++++++++------
 proxy/congest/Congestion.h  |  5 -----
 3 files changed, 10 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2f6be791/proxy/ControlMatcher.h
----------------------------------------------------------------------
diff --git a/proxy/ControlMatcher.h b/proxy/ControlMatcher.h
index 5c1158d..b53708a 100644
--- a/proxy/ControlMatcher.h
+++ b/proxy/ControlMatcher.h
@@ -127,17 +127,6 @@ public:
 
   virtual sockaddr const *get_client_ip() = 0;
 
-  enum RD_Type {
-    RD_NULL,
-    RD_HTTP,
-    RD_CONGEST_ENTRY,
-  };
-
-  virtual RD_Type
-  data_type(void)
-  {
-    return RD_NULL;
-  }
 };
 
 class HttpRequestData : public RequestData

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2f6be791/proxy/congest/Congestion.cc
----------------------------------------------------------------------
diff --git a/proxy/congest/Congestion.cc b/proxy/congest/Congestion.cc
index 28bb2eb..f952881 100644
--- a/proxy/congest/Congestion.cc
+++ b/proxy/congest/Congestion.cc
@@ -256,16 +256,20 @@ CongestionControlRecord::UpdateMatch(CongestionControlRule *pRule, RequestData *
    */
   if (pRule->record == 0 || pRule->record->rank < rank || (pRule->record->line_num > line_num && pRule->record->rank == rank)) {
     if (rank > 0) {
-      if (rdata->data_type() == RequestData::RD_CONGEST_ENTRY) {
+      CongestionEntry* entry = dynamic_cast<CongestionEntry*>(rdata);
+      if (entry) {
         // Enforce the same port and prefix
-        if (port != 0 && port != ((CongestionEntry *)rdata)->pRecord->port)
+        if (port != 0 && port != entry->pRecord->port)
           return;
-        if (prefix != NULL && ((CongestionEntry *)rdata)->pRecord->prefix == NULL)
+        if (prefix != NULL && entry->pRecord->prefix == NULL)
           return;
-        if (prefix != NULL && strncmp(prefix, ((CongestionEntry *)rdata)->pRecord->prefix, prefix_len))
+        if (prefix != NULL && strncmp(prefix, entry->pRecord->prefix, prefix_len))
           return;
-      } else if (!this->CheckModifiers((HttpRequestData *)rdata)) {
-        return;
+      } else {
+	HttpRequestData* h = dynamic_cast<HttpRequestData*>(rdata);
+	if (h && !this->CheckModifiers(h)) {
+	  return;
+	}
       }
     }
     pRule->record = this;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2f6be791/proxy/congest/Congestion.h
----------------------------------------------------------------------
diff --git a/proxy/congest/Congestion.h b/proxy/congest/Congestion.h
index e792837..85786fc 100644
--- a/proxy/congest/Congestion.h
+++ b/proxy/congest/Congestion.h
@@ -225,11 +225,6 @@ struct CongestionEntry : public RequestData {
   {
     return NULL;
   }
-  virtual RD_Type
-  data_type(void)
-  {
-    return RD_CONGEST_ENTRY;
-  }
 
   /* print the entry into the congested list output buffer */
   int sprint(char *buf, int buflen, int format = 0);