Changes HttpSM to be Proxy Allocated (#8082)
diff --git a/iocore/eventsystem/I_Thread.h b/iocore/eventsystem/I_Thread.h
index 3c7905b..f0f5d38 100644
--- a/iocore/eventsystem/I_Thread.h
+++ b/iocore/eventsystem/I_Thread.h
@@ -122,6 +122,7 @@
ProxyAllocator http1ClientSessionAllocator;
ProxyAllocator http2ClientSessionAllocator;
ProxyAllocator http2StreamAllocator;
+ ProxyAllocator httpSMAllocator;
ProxyAllocator quicClientSessionAllocator;
ProxyAllocator httpServerSessionAllocator;
ProxyAllocator hdrHeapAllocator;
diff --git a/proxy/ProxyTransaction.cc b/proxy/ProxyTransaction.cc
index bb63ebc..3f1ace9 100644
--- a/proxy/ProxyTransaction.cc
+++ b/proxy/ProxyTransaction.cc
@@ -26,6 +26,8 @@
#define HttpTxnDebug(fmt, ...) SsnDebug(this, "http_txn", fmt, __VA_ARGS__)
+extern ClassAllocator<HttpSM> httpSMAllocator;
+
ProxyTransaction::ProxyTransaction(ProxySession *session) : VConnection(nullptr), _proxy_ssn(session) {}
ProxyTransaction::~ProxyTransaction()
@@ -43,7 +45,7 @@
// connection re-use
ink_release_assert(_proxy_ssn != nullptr);
- _sm = HttpSM::allocate();
+ _sm = THREAD_ALLOC(httpSMAllocator, this_thread());
_sm->init(from_early_data);
HttpTxnDebug("[%" PRId64 "] Starting transaction %d using sm [%" PRId64 "]", _proxy_ssn->connection_id(),
_proxy_ssn->get_transact_count(), _sm->sm_id);
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index f45a902..1634c1e 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -375,7 +375,7 @@
HttpSM::destroy()
{
cleanup();
- httpSMAllocator.free(this);
+ THREAD_FREE(this, httpSMAllocator, this_thread());
}
void
diff --git a/proxy/http/HttpSM.h b/proxy/http/HttpSM.h
index bac1c8a..ad97d72 100644
--- a/proxy/http/HttpSM.h
+++ b/proxy/http/HttpSM.h
@@ -703,13 +703,6 @@
return cache_sm;
}
-inline HttpSM *
-HttpSM::allocate()
-{
- extern ClassAllocator<HttpSM> httpSMAllocator;
- return httpSMAllocator.alloc();
-}
-
inline int
HttpSM::write_response_header_into_buffer(HTTPHdr *h, MIOBuffer *b)
{
diff --git a/src/traffic_server/InkAPITest.cc b/src/traffic_server/InkAPITest.cc
index af0374e..4f9b10c 100644
--- a/src/traffic_server/InkAPITest.cc
+++ b/src/traffic_server/InkAPITest.cc
@@ -8696,11 +8696,13 @@
"proxy.config.hostdb.ip_resolve",
"proxy.config.http.connect.dead.policy"}};
+extern ClassAllocator<HttpSM> httpSMAllocator;
+
REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS)(RegressionTest *test, int /* atype ATS_UNUSED */, int *pstatus)
{
TSOverridableConfigKey key;
TSRecordDataType type;
- HttpSM *s = HttpSM::allocate();
+ HttpSM *s = THREAD_ALLOC(httpSMAllocator, this_thread());
bool success = true;
TSHttpTxn txnp = reinterpret_cast<TSHttpTxn>(s);
InkRand generator(17);
@@ -8804,7 +8806,7 @@
REGRESSION_TEST(SDK_API_TXN_HTTP_INFO_GET)(RegressionTest *test, int /* atype ATS_UNUSED */, int *pstatus)
{
- HttpSM *s = HttpSM::allocate();
+ HttpSM *s = THREAD_ALLOC(httpSMAllocator, this_thread());
bool success = true;
TSHttpTxn txnp = reinterpret_cast<TSHttpTxn>(s);
TSMgmtInt ival_read;