This is an automated email from the ASF dual-hosted git repository.

maskit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new d9807dd  Call constructors and destructors for H1/2 
Session/Transaction via ClassAllocator (#7584)
d9807dd is described below

commit d9807ddb610bc95194125113801c5efe8cbde47e
Author: Masakazu Kitajo <[email protected]>
AuthorDate: Thu Mar 11 07:48:24 2021 +0900

    Call constructors and destructors for H1/2 Session/Transaction via 
ClassAllocator (#7584)
---
 proxy/http/Http1ClientSession.cc    | 3 +--
 proxy/http/Http1ClientSession.h     | 2 +-
 proxy/http/Http1ServerSession.cc    | 3 +--
 proxy/http/Http1ServerSession.h     | 2 +-
 proxy/http/HttpSM.cc                | 1 -
 proxy/http/HttpSessionAccept.cc     | 1 -
 proxy/http2/Http2ClientSession.cc   | 3 +--
 proxy/http2/Http2ClientSession.h    | 2 +-
 proxy/http2/Http2ConnectionState.cc | 4 ++--
 proxy/http2/Http2SessionAccept.cc   | 5 ++---
 proxy/http2/Http2Stream.cc          | 2 +-
 proxy/http2/Http2Stream.h           | 2 +-
 12 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/proxy/http/Http1ClientSession.cc b/proxy/http/Http1ClientSession.cc
index 1cdd756..34602d0 100644
--- a/proxy/http/Http1ClientSession.cc
+++ b/proxy/http/Http1ClientSession.cc
@@ -57,7 +57,7 @@ ink_mutex debug_cs_list_mutex;
 
 #endif /* USE_HTTP_DEBUG_LISTS */
 
-ClassAllocator<Http1ClientSession> 
http1ClientSessionAllocator("http1ClientSessionAllocator");
+ClassAllocator<Http1ClientSession, true> 
http1ClientSessionAllocator("http1ClientSessionAllocator");
 
 Http1ClientSession::Http1ClientSession() : super(), trans(this) {}
 
@@ -120,7 +120,6 @@ Http1ClientSession::free()
     _vc = nullptr;
   }
 
-  this->~Http1ClientSession();
   THREAD_FREE(this, http1ClientSessionAllocator, this_thread());
 }
 
diff --git a/proxy/http/Http1ClientSession.h b/proxy/http/Http1ClientSession.h
index 1509806..4c4d0de 100644
--- a/proxy/http/Http1ClientSession.h
+++ b/proxy/http/Http1ClientSession.h
@@ -129,4 +129,4 @@ public:
   Http1Transaction trans;
 };
 
-extern ClassAllocator<Http1ClientSession> http1ClientSessionAllocator;
+extern ClassAllocator<Http1ClientSession, true> http1ClientSessionAllocator;
diff --git a/proxy/http/Http1ServerSession.cc b/proxy/http/Http1ServerSession.cc
index d800b03..eff73af 100644
--- a/proxy/http/Http1ServerSession.cc
+++ b/proxy/http/Http1ServerSession.cc
@@ -36,7 +36,7 @@
 #include "HttpSessionManager.h"
 #include "HttpSM.h"
 
-ClassAllocator<Http1ServerSession> 
httpServerSessionAllocator("httpServerSessionAllocator");
+ClassAllocator<Http1ServerSession, true> 
httpServerSessionAllocator("httpServerSessionAllocator");
 
 void
 Http1ServerSession::destroy()
@@ -50,7 +50,6 @@ Http1ServerSession::destroy()
   }
 
   mutex.clear();
-  this->~Http1ServerSession();
   if (httpSessionManager.get_pool_type() == 
TS_SERVER_SESSION_SHARING_POOL_THREAD) {
     THREAD_FREE(this, httpServerSessionAllocator, this_thread());
   } else {
diff --git a/proxy/http/Http1ServerSession.h b/proxy/http/Http1ServerSession.h
index 95e7ebc..0de92de 100644
--- a/proxy/http/Http1ServerSession.h
+++ b/proxy/http/Http1ServerSession.h
@@ -107,7 +107,7 @@ private:
   IOBufferReader *buf_reader = nullptr;
 };
 
-extern ClassAllocator<Http1ServerSession> httpServerSessionAllocator;
+extern ClassAllocator<Http1ServerSession, true> httpServerSessionAllocator;
 
 ////////////////////////////////////////////
 // INLINE
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 91bf4f2..37d1a63 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -1819,7 +1819,6 @@ HttpSM::state_http_server_open(int event, void *data)
     Http1ServerSession *session = (TS_SERVER_SESSION_SHARING_POOL_THREAD == 
httpSessionManager.get_pool_type()) ?
                                     
THREAD_ALLOC_INIT(httpServerSessionAllocator, mutex->thread_holding) :
                                     httpServerSessionAllocator.alloc();
-    new (session) Http1ServerSession();
     session->sharing_pool  = 
static_cast<TSServerSessionSharingPoolType>(t_state.http_config_param->server_session_sharing_pool);
     session->sharing_match = 
static_cast<TSServerSessionSharingMatchMask>(t_state.txn_conf->server_session_sharing_match);
 
diff --git a/proxy/http/HttpSessionAccept.cc b/proxy/http/HttpSessionAccept.cc
index c7d3b1f..ea9d075 100644
--- a/proxy/http/HttpSessionAccept.cc
+++ b/proxy/http/HttpSessionAccept.cc
@@ -50,7 +50,6 @@ HttpSessionAccept::accept(NetVConnection *netvc, MIOBuffer 
*iobuf, IOBufferReade
   }
 
   Http1ClientSession *new_session = 
THREAD_ALLOC_INIT(http1ClientSessionAllocator, this_ethread());
-  new (new_session) Http1ClientSession();
 
   new_session->accept_options = static_cast<Options *>(this);
   new_session->acl            = std::move(acl);
diff --git a/proxy/http2/Http2ClientSession.cc 
b/proxy/http2/Http2ClientSession.cc
index 838e0a8..5021d18 100644
--- a/proxy/http2/Http2ClientSession.cc
+++ b/proxy/http2/Http2ClientSession.cc
@@ -47,7 +47,7 @@
     this->session_handler = (handler);     \
   } while (0)
 
-ClassAllocator<Http2ClientSession> 
http2ClientSessionAllocator("http2ClientSessionAllocator");
+ClassAllocator<Http2ClientSession, true> 
http2ClientSessionAllocator("http2ClientSessionAllocator");
 
 // memcpy the requested bytes from the IOBufferReader, returning how many were
 // actually copied.
@@ -163,7 +163,6 @@ Http2ClientSession::free()
 
   free_MIOBuffer(this->read_buffer);
   free_MIOBuffer(this->write_buffer);
-  this->~Http2ClientSession();
   THREAD_FREE(this, http2ClientSessionAllocator, this_ethread());
 }
 
diff --git a/proxy/http2/Http2ClientSession.h b/proxy/http2/Http2ClientSession.h
index 2efc66d..79ff41c 100644
--- a/proxy/http2/Http2ClientSession.h
+++ b/proxy/http2/Http2ClientSession.h
@@ -175,7 +175,7 @@ private:
   bool cur_frame_from_early_data = false;
 };
 
-extern ClassAllocator<Http2ClientSession> http2ClientSessionAllocator;
+extern ClassAllocator<Http2ClientSession, true> http2ClientSessionAllocator;
 
 ///////////////////////////////////////////////
 // INLINE
diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index 1ee9c2b..7576752 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -1220,8 +1220,8 @@ Http2ConnectionState::create_stream(Http2StreamId new_id, 
Http2Error &error)
     }
   }
 
-  Http2Stream *new_stream = THREAD_ALLOC_INIT(http2StreamAllocator, 
this_ethread());
-  new (new_stream) Http2Stream(ua_session, new_id, 
client_settings.get(HTTP2_SETTINGS_INITIAL_WINDOW_SIZE));
+  Http2Stream *new_stream = THREAD_ALLOC_INIT(http2StreamAllocator, 
this_ethread(), ua_session, new_id,
+                                              
client_settings.get(HTTP2_SETTINGS_INITIAL_WINDOW_SIZE));
 
   ink_assert(nullptr != new_stream);
   ink_assert(!stream_list.in(new_stream));
diff --git a/proxy/http2/Http2SessionAccept.cc 
b/proxy/http2/Http2SessionAccept.cc
index 3e02dc3..f0226fd 100644
--- a/proxy/http2/Http2SessionAccept.cc
+++ b/proxy/http2/Http2SessionAccept.cc
@@ -54,9 +54,8 @@ Http2SessionAccept::accept(NetVConnection *netvc, MIOBuffer 
*iobuf, IOBufferRead
   }
 
   Http2ClientSession *new_session = 
THREAD_ALLOC_INIT(http2ClientSessionAllocator, this_ethread());
-  new (new_session) Http2ClientSession();
-  new_session->acl            = std::move(session_acl);
-  new_session->accept_options = &options;
+  new_session->acl                = std::move(session_acl);
+  new_session->accept_options     = &options;
 
   // Pin session to current ET_NET thread
   new_session->setThreadAffinity(this_ethread());
diff --git a/proxy/http2/Http2Stream.cc b/proxy/http2/Http2Stream.cc
index 25a4d64..53146bc 100644
--- a/proxy/http2/Http2Stream.cc
+++ b/proxy/http2/Http2Stream.cc
@@ -37,7 +37,7 @@
 #define Http2StreamDebug(fmt, ...) \
   SsnDebug(_proxy_ssn, "http2_stream", "[%" PRId64 "] [%u] " fmt, 
_proxy_ssn->connection_id(), this->get_id(), ##__VA_ARGS__);
 
-ClassAllocator<Http2Stream> http2StreamAllocator("http2StreamAllocator");
+ClassAllocator<Http2Stream, true> http2StreamAllocator("http2StreamAllocator");
 
 Http2Stream::Http2Stream(ProxySession *session, Http2StreamId sid, ssize_t 
initial_rwnd)
   : super(session), _id(sid), _client_rwnd(initial_rwnd)
diff --git a/proxy/http2/Http2Stream.h b/proxy/http2/Http2Stream.h
index dfac308..1d8d7b6 100644
--- a/proxy/http2/Http2Stream.h
+++ b/proxy/http2/Http2Stream.h
@@ -220,7 +220,7 @@ private:
   Event *_write_vio_event = nullptr;
 };
 
-extern ClassAllocator<Http2Stream> http2StreamAllocator;
+extern ClassAllocator<Http2Stream, true> http2StreamAllocator;
 
 ////////////////////////////////////////////////////
 // INLINE

Reply via email to