duke8253 commented on a change in pull request #7405:
URL: https://github.com/apache/trafficserver/pull/7405#discussion_r562074904



##########
File path: iocore/net/SSLSessionCache.cc
##########
@@ -129,51 +129,50 @@ SSLSessionBucket::insertSession(const SSLSessionID &id, 
SSL_SESSION *sess, SSL *
     Debug("ssl.session_cache", "Inserting session '%s' to bucket %p.", buf, 
this);
   }
 
-  MUTEX_TRY_LOCK(lock, mutex, this_ethread());
-  if (!lock.is_locked()) {
+  Ptr<IOBufferData> buf;
+  Ptr<IOBufferData> buf_exdata;
+  size_t len_exdata = sizeof(ssl_session_cache_exdata);
+  buf               = new_IOBufferData(buffer_size_to_index(len, 
MAX_BUFFER_SIZE_INDEX), MEMALIGNED);
+  ink_release_assert(static_cast<size_t>(buf->block_size()) >= len);
+  unsigned char *loc = reinterpret_cast<unsigned char *>(buf->data());
+  i2d_SSL_SESSION(sess, &loc);
+  buf_exdata = new_IOBufferData(buffer_size_to_index(len, 
MAX_BUFFER_SIZE_INDEX), MEMALIGNED);
+  ink_release_assert(static_cast<size_t>(buf_exdata->block_size()) >= 
len_exdata);
+  ssl_session_cache_exdata *exdata = reinterpret_cast<ssl_session_cache_exdata 
*>(buf_exdata->data());
+  // This could be moved to a function in charge of populating exdata
+  exdata->curve  = (ssl == nullptr) ? 0 : SSLGetCurveNID(ssl);
+  ink_hrtime now = Thread::get_hrtime_updated();

Review comment:
       This is more of a way to make sure the keys in the map is always updated 
with no duplication, such that the map and unordered_map always have the same 
number of entries. Otherwise the `removeOldestSession` might not find a session 
to remove, but in reality the session is still in the unordered_map, just not 
in the map.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to