Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions proxy/ProxySession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ ProxySession::ProxySession() : VConnection(nullptr) {}

ProxySession::ProxySession(NetVConnection *vc) : VConnection(nullptr), _vc(vc) {}

ProxySession::~ProxySession()
{
if (schedule_event) {
schedule_event->cancel();
schedule_event = nullptr;
}
this->api_hooks.clear();
this->mutex.clear();
this->acl.clear();
this->_ssl.reset();
}

void
ProxySession::set_session_active()
{
Expand Down Expand Up @@ -69,19 +81,6 @@ static const TSEvent eventmap[TS_HTTP_LAST_HOOK + 1] = {
TS_EVENT_NONE, // TS_HTTP_LAST_HOOK
};

void
ProxySession::free()
{
if (schedule_event) {
schedule_event->cancel();
schedule_event = nullptr;
}
this->api_hooks.clear();
this->mutex.clear();
this->acl.clear();
this->_ssl.reset();
}

int
ProxySession::state_api_callout(int event, void *data)
{
Expand Down
3 changes: 2 additions & 1 deletion proxy/ProxySession.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class ProxySession : public VConnection, public PluginUserArgs<TS_USER_ARGS_SSN>
public:
ProxySession();
ProxySession(NetVConnection *vc);
virtual ~ProxySession();

// noncopyable
ProxySession(ProxySession &) = delete;
Expand All @@ -94,7 +95,7 @@ class ProxySession : public VConnection, public PluginUserArgs<TS_USER_ARGS_SSN>
virtual void release(ProxyTransaction *trans) = 0;

virtual void destroy() = 0;
virtual void free();
virtual void free() = 0;

virtual void increment_current_active_connections_stat() = 0;
virtual void decrement_current_active_connections_stat() = 0;
Expand Down
13 changes: 6 additions & 7 deletions proxy/ProxyTransaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@

ProxyTransaction::ProxyTransaction(ProxySession *session) : VConnection(nullptr), _proxy_ssn(session) {}

ProxyTransaction::~ProxyTransaction()
{
this->_sm = nullptr;
this->mutex.clear();
}

void
ProxyTransaction::new_transaction(bool from_early_data)
{
Expand Down Expand Up @@ -61,13 +67,6 @@ ProxyTransaction::attach_server_session(PoolableSession *ssession, bool transact
return _proxy_ssn->attach_server_session(ssession, transaction_done);
}

void
ProxyTransaction::destroy()
{
_sm = nullptr;
this->mutex.clear();
}

void
ProxyTransaction::set_rx_error_code(ProxyError e)
{
Expand Down
2 changes: 1 addition & 1 deletion proxy/ProxyTransaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class ProxyTransaction : public VConnection
public:
ProxyTransaction() : VConnection(nullptr) {}
ProxyTransaction(ProxySession *ssn);
virtual ~ProxyTransaction();

/// Virtual Methods
//
Expand All @@ -42,7 +43,6 @@ class ProxyTransaction : public VConnection
Action *adjust_thread(Continuation *cont, int event, void *data);
virtual void release(IOBufferReader *r) = 0;
virtual void transaction_done();
virtual void destroy();

virtual void set_active_timeout(ink_hrtime timeout_in);
virtual void set_inactivity_timeout(ink_hrtime timeout_in);
Expand Down
12 changes: 5 additions & 7 deletions proxy/http/Http1ClientSession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,12 @@ Http1ClientSession::free()
conn_decrease = false;
}

// Free the transaction resources
this->trans.super_type::destroy();

if (_vc) {
_vc->do_io_close();
_vc = nullptr;
}

super::free();
this->~Http1ClientSession();
THREAD_FREE(this, http1ClientSessionAllocator, this_thread());
}

Expand Down Expand Up @@ -394,7 +391,8 @@ Http1ClientSession::release(ProxyTransaction *trans)

// When release is called from start() to read the first transaction, get_sm()
// will return null.
HttpSM *sm = trans->get_sm();
HttpSM *sm = trans->get_sm();
Http1Transaction *h1trans = static_cast<Http1Transaction *>(trans);
if (sm) {
MgmtInt ka_in = trans->get_sm()->t_state.txn_conf->keep_alive_no_activity_timeout_in;
set_inactivity_timeout(HRTIME_SECONDS(ka_in));
Expand All @@ -412,7 +410,7 @@ Http1ClientSession::release(ProxyTransaction *trans)
// IO to wait for new data
bool more_to_read = this->_reader->is_read_avail_more_than(0);
if (more_to_read) {
trans->destroy();
h1trans->reset();
HttpSsnDebug("[%" PRId64 "] data already in buffer, starting new transaction", con_id);
new_transaction();
} else {
Expand All @@ -426,7 +424,7 @@ Http1ClientSession::release(ProxyTransaction *trans)
_vc->cancel_active_timeout();
_vc->add_to_keep_alive_queue();
}
trans->destroy();
h1trans->reset();
}
}

Expand Down
1 change: 1 addition & 0 deletions proxy/http/Http1ClientSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Http1ClientSession : public ProxySession
public:
typedef ProxySession super; ///< Parent type.
Http1ClientSession();
~Http1ClientSession() = default;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't necessary.


// Implement ProxySession interface.
void new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOBufferReader *reader) override;
Expand Down
7 changes: 7 additions & 0 deletions proxy/http/Http1ServerSession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,20 @@ Http1ServerSession::destroy()
}

mutex.clear();
this->~Http1ServerSession();
if (httpSessionManager.get_pool_type() == TS_SERVER_SESSION_SHARING_POOL_THREAD) {
THREAD_FREE(this, httpServerSessionAllocator, this_thread());
} else {
httpServerSessionAllocator.free(this);
}
}

void
Http1ServerSession::free()
{
// Unlike Http1ClientSession, Http1ServerSession is freed in destroy()
}

void
Http1ServerSession::new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOBufferReader *reader)
{
Expand Down
2 changes: 2 additions & 0 deletions proxy/http/Http1ServerSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ class Http1ServerSession : public PoolableSession
Http1ServerSession() : super_type() {}
Http1ServerSession(self_type const &) = delete;
self_type &operator=(self_type const &) = delete;
~Http1ServerSession() = default;

////////////////////
// Methods
void release(ProxyTransaction *) override;
void destroy() override;
void free() override;

// VConnection Methods
void do_io_close(int lerrno = -1) override;
Expand Down
2 changes: 1 addition & 1 deletion proxy/http/Http1Transaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Http1Transaction::release(IOBufferReader *r)
}

void
Http1Transaction::destroy() // todo make ~Http1Transaction()
Http1Transaction::reset()
{
_sm = nullptr;
}
Expand Down
3 changes: 2 additions & 1 deletion proxy/http/Http1Transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,19 @@ class Http1Transaction : public ProxyTransaction
using super_type = ProxyTransaction;

Http1Transaction(ProxySession *session) : super_type(session) {}
~Http1Transaction() = default;

////////////////////
// Methods
void release(IOBufferReader *r) override;
void destroy() override; // todo make ~Http1Transaction()

bool allow_half_open() const override;
void transaction_done() override;
int get_transaction_id() const override;
void increment_client_transactions_stat() override;
void decrement_client_transactions_stat() override;

void reset();
void set_reader(IOBufferReader *reader);

////////////////////
Expand Down
3 changes: 1 addition & 2 deletions proxy/http2/Http2ClientSession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,9 @@ Http2ClientSession::free()
delete _h2_pushed_urls;
this->connection_state.destroy();

super::free();

free_MIOBuffer(this->read_buffer);
free_MIOBuffer(this->write_buffer);
this->~Http2ClientSession();
THREAD_FREE(this, http2ClientSessionAllocator, this_ethread());
}

Expand Down
Loading