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



##########
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();
+
+  ats_scoped_obj<SSLSession> ssl_session(new SSLSession(id, buf, len, 
buf_exdata, now));

Review comment:
       Actually I'm not sure why we create a new session object of our own 
here, I checked the OpenSSL code and the reference count of the `SSL_SESSION` 
is incremented when it goes into the new session callback. Which also means I 
need to check if we're leaking memory here since I don't think we're calling 
`SSL_SESSION_free`.




----------------------------------------------------------------
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