trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject trafficserver git commit: TS-3505 A few improvements, thanks Gancho for review
Date Sun, 26 Apr 2015 21:59:40 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master d9f1bc531 -> 778b952d9


TS-3505 A few improvements, thanks Gancho for review


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

Branch: refs/heads/master
Commit: 778b952d9983c96508653f0d70e0e03c7e30f713
Parents: d9f1bc5
Author: Leif Hedstrom <zwoop@apache.org>
Authored: Sun Apr 26 15:59:19 2015 -0600
Committer: Leif Hedstrom <zwoop@apache.org>
Committed: Sun Apr 26 15:59:19 2015 -0600

----------------------------------------------------------------------
 .../experimental/cache_promote/cache_promote.cc | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/778b952d/plugins/experimental/cache_promote/cache_promote.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/cache_promote/cache_promote.cc b/plugins/experimental/cache_promote/cache_promote.cc
index 76368a2..d3820b9 100644
--- a/plugins/experimental/cache_promote/cache_promote.cc
+++ b/plugins/experimental/cache_promote/cache_promote.cc
@@ -197,16 +197,7 @@ typedef std::map<LRUHash *, LRUList::iterator> LRUMap;
 class LRUPolicy : public PromotionPolicy
 {
 public:
-  LRUPolicy() : PromotionPolicy(), _buckets(1000), _hits(10)
-  {
-    // This doesn't have to be perfect, since this is just chance sampling.
-    // coverity[dont_call]
-    srand48((long)time(NULL) ^ (long)getpid() ^ (long)getppid());
-#if HAVE_UNORDERED_MAP
-    _map.reserve(_buckets);
-#endif
-    _lock = TSMutexCreate();
-  }
+  LRUPolicy() : PromotionPolicy(), _buckets(1000), _hits(10), _lock(TSMutexCreate()) {}
 
   ~LRUPolicy()
   {
@@ -237,6 +228,13 @@ public:
       return false;
     }
 
+    // This doesn't have to be perfect, since this is just chance sampling.
+    // coverity[dont_call]
+    srand48((long)time(NULL) ^ (long)getpid() ^ (long)getppid());
+#if HAVE_UNORDERED_MAP
+    _map.reserve(_buckets);
+#endif
+
     return true;
   }
 
@@ -257,7 +255,7 @@ public:
 
     map_it = _map.find(&hash);
     if (_map.end() != map_it) {
-      // We have an entry in the URL
+      // We have an entry in the LRU
       if (++(map_it->second->second) >= _hits) {
         // Promoted! Cleanup the LRU, and signal success. Save the promoted entry on the
freelist.
         TSDebug(PLUGIN_NAME, "saving the LRUEntry to the freelist");


Mime
View raw message