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 2014/11/20 22:40:58 UTC

trafficserver git commit: TS-3080: Fix potential problem with dependency of bucket list size on external and changeable value.

Repository: trafficserver
Updated Branches:
  refs/heads/master 10ddb595e -> 2a909df77


TS-3080: Fix potential problem with dependency of bucket list size on external and changeable value.


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

Branch: refs/heads/master
Commit: 2a909df7774ab4f903014c5692a44a9a8ff463af
Parents: 10ddb59
Author: Alan M. Carroll <so...@yahoo-inc.com>
Authored: Mon Nov 10 22:33:17 2014 -0600
Committer: Alan M. Carroll <so...@yahoo-inc.com>
Committed: Mon Nov 10 22:33:17 2014 -0600

----------------------------------------------------------------------
 iocore/net/SSLSessionCache.cc | 14 ++++++++------
 iocore/net/SSLSessionCache.h  |  1 +
 2 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2a909df7/iocore/net/SSLSessionCache.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLSessionCache.cc b/iocore/net/SSLSessionCache.cc
index 3356571..2d059fe 100644
--- a/iocore/net/SSLSessionCache.cc
+++ b/iocore/net/SSLSessionCache.cc
@@ -38,10 +38,12 @@ using ts::detail::RBNode;
 
 /* Session Cache */
 SSLSessionCache::SSLSessionCache()
-  : session_bucket(NULL) {
-  Debug("ssl.session_cache", "Created new ssl session cache %p with %ld buckets each with size max size %ld", this, SSLConfigParams::session_cache_number_buckets, SSLConfigParams::session_cache_max_bucket_size);
+  : session_bucket(NULL), nbuckets(SSLConfigParams::session_cache_number_buckets)
+{
+  Debug("ssl.session_cache", "Created new ssl session cache %p with %ld buckets each with size max size %ld",
+    this, nbuckets, SSLConfigParams::session_cache_max_bucket_size);
 
-  session_bucket = new SSLSessionBucket[SSLConfigParams::session_cache_number_buckets];
+  session_bucket = new SSLSessionBucket[nbuckets];
 }
 
 SSLSessionCache::~SSLSessionCache() {
@@ -50,7 +52,7 @@ SSLSessionCache::~SSLSessionCache() {
 
 bool SSLSessionCache::getSession(const SSLSessionID &sid, SSL_SESSION **sess) const {
   uint64_t hash = sid.hash();
-  uint64_t target_bucket = hash % SSLConfigParams::session_cache_number_buckets;
+  uint64_t target_bucket = hash % nbuckets;
   SSLSessionBucket *bucket = &session_bucket[target_bucket];
   bool ret = false;
 
@@ -72,7 +74,7 @@ bool SSLSessionCache::getSession(const SSLSessionID &sid, SSL_SESSION **sess) co
 
 void SSLSessionCache::removeSession(const SSLSessionID &sid) {
   uint64_t hash = sid.hash();
-  uint64_t target_bucket = hash % SSLConfigParams::session_cache_number_buckets;
+  uint64_t target_bucket = hash % nbuckets;
   SSLSessionBucket *bucket = &session_bucket[target_bucket];
 
   if (is_debug_tag_set("ssl.session_cache")) {
@@ -87,7 +89,7 @@ void SSLSessionCache::removeSession(const SSLSessionID &sid) {
 
 void SSLSessionCache::insertSession(const SSLSessionID &sid, SSL_SESSION *sess) {
   uint64_t hash = sid.hash();
-  uint64_t target_bucket = hash % SSLConfigParams::session_cache_number_buckets;
+  uint64_t target_bucket = hash % nbuckets;
   SSLSessionBucket *bucket = &session_bucket[target_bucket];
 
   if (is_debug_tag_set("ssl.session_cache")) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2a909df7/iocore/net/SSLSessionCache.h
----------------------------------------------------------------------
diff --git a/iocore/net/SSLSessionCache.h b/iocore/net/SSLSessionCache.h
index 5a6f59b..240b251 100644
--- a/iocore/net/SSLSessionCache.h
+++ b/iocore/net/SSLSessionCache.h
@@ -141,6 +141,7 @@ public:
 
  private:
     SSLSessionBucket *session_bucket;
+    size_t nbuckets;
 };
 
 #endif /* __SSLSESSIONCACHE_H__ */