Skip to content
Closed
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
15 changes: 15 additions & 0 deletions proxy/ProxySession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ ProxySession::ProxySession(NetVConnection *vc) : VConnection(nullptr), _vc(vc) {

ProxySession::~ProxySession()
{
ink_assert(!this->_need_do_io_close);

if (schedule_event) {
schedule_event->cancel();
schedule_event = nullptr;
Expand Down Expand Up @@ -280,12 +282,18 @@ ProxySession::_handle_if_ssl(NetVConnection *new_vc)
VIO *
ProxySession::do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf)
{
if (buf) {
this->_need_do_io_close = true;
}
return _vc ? this->_vc->do_io_read(c, nbytes, buf) : nullptr;
}

VIO *
ProxySession::do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *buf, bool owner)
{
if (buf) {
this->_need_do_io_close = true;
}
return _vc ? this->_vc->do_io_write(c, nbytes, buf, owner) : nullptr;
}

Expand All @@ -295,6 +303,13 @@ ProxySession::do_io_shutdown(ShutdownHowTo_t howto)
this->_vc->do_io_shutdown(howto);
}

void
ProxySession::do_io_close(int alerrno)
{
this->_need_do_io_close = false;
this->_do_io_close(alerrno);
}

void
ProxySession::reenable(VIO *vio)
{
Expand Down
5 changes: 5 additions & 0 deletions proxy/ProxySession.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ class ProxySession : public VConnection, public PluginUserArgs<TS_USER_ARGS_SSN>
VIO *do_io_read(Continuation *c, int64_t nbytes = INT64_MAX, MIOBuffer *buf = nullptr) override;
VIO *do_io_write(Continuation *c = nullptr, int64_t nbytes = INT64_MAX, IOBufferReader *buf = 0, bool owner = false) override;
void do_io_shutdown(ShutdownHowTo_t howto) override;
void do_io_close(int alerrno = -1) override;
void reenable(VIO *vio) override;

////////////////////
Expand All @@ -167,6 +168,8 @@ class ProxySession : public VConnection, public PluginUserArgs<TS_USER_ARGS_SSN>
ink_hrtime ssn_last_txn_time = 0;

protected:
virtual void _do_io_close(int alerrno) = 0;

// Hook dispatching state
HttpHookState hook_state;

Expand Down Expand Up @@ -201,6 +204,8 @@ class ProxySession : public VConnection, public PluginUserArgs<TS_USER_ARGS_SSN>

std::unique_ptr<SSLProxySession> _ssl;
static inline int64_t next_cs_id = 0;

bool _need_do_io_close = false;
};

///////////////////
Expand Down
2 changes: 1 addition & 1 deletion proxy/http/Http1ClientSession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ Http1ClientSession::new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOB
}

void
Http1ClientSession::do_io_close(int alerrno)
Http1ClientSession::_do_io_close(int alerrno)
{
if (read_state == HCS_CLOSED) {
return; // Don't double call session close
Expand Down
7 changes: 4 additions & 3 deletions proxy/http/Http1ClientSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ class Http1ClientSession : public ProxySession

bool attach_server_session(PoolableSession *ssession, bool transaction_done = true) override;

// Implement VConnection interface.
void do_io_close(int lerrno = -1) override;

// Accessor Methods
bool allow_half_open() const;
void set_half_close_flag(bool flag) override;
Expand All @@ -83,6 +80,10 @@ class Http1ClientSession : public ProxySession
void increment_current_active_connections_stat() override;
void decrement_current_active_connections_stat() override;

protected:
// Implement ProxySession interface
void _do_io_close(int lerrno) override;

private:
Http1ClientSession(Http1ClientSession &);

Expand Down
2 changes: 1 addition & 1 deletion proxy/http/Http1ServerSession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Http1ServerSession::enable_outbound_connection_tracking(OutboundConnTrack::Group
}

void
Http1ServerSession::do_io_close(int alerrno)
Http1ServerSession::_do_io_close(int alerrno)
{
ts::LocalBufferWriter<256> w;
bool debug_p = is_debug_tag_set("http_ss");
Expand Down
7 changes: 4 additions & 3 deletions proxy/http/Http1ServerSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ class Http1ServerSession : public PoolableSession
void destroy() override;
void free() override;

// VConnection Methods
void do_io_close(int lerrno = -1) override;

// ProxySession Methods
int get_transact_count() const override;
const char *get_protocol_string() const override;
Expand Down Expand Up @@ -101,6 +98,10 @@ class Http1ServerSession : public PoolableSession
// an asynchronous cancel on NT
MIOBuffer *read_buffer = nullptr;

protected:
// Implement ProxySession interface
void _do_io_close(int lerrno) override;

private:
int magic = HTTP_SS_MAGIC_DEAD;

Expand Down
2 changes: 1 addition & 1 deletion proxy/http2/Http2ClientSession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ Http2ClientSession::new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOB
// are scenarios where we would like to complete the outstanding streams.

void
Http2ClientSession::do_io_close(int alerrno)
Http2ClientSession::_do_io_close(int alerrno)
{
REMEMBER(NO_EVENT, this->recursion)
Http2SsnDebug("session closed");
Expand Down
6 changes: 3 additions & 3 deletions proxy/http2/Http2ClientSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ class Http2ClientSession : public ProxySession
/////////////////////
// Methods

// Implement VConnection interface
void do_io_close(int lerrno = -1) override;

// Implement ProxySession interface
void new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOBufferReader *reader) override;
void start() override;
Expand Down Expand Up @@ -134,6 +131,9 @@ class Http2ClientSession : public ProxySession
// if there are multiple frames ready on the wire
int state_process_frame_read(int event, VIO *vio, bool inside_frame);

// Implement ProxySession interface
void _do_io_close(int lerrno) override;

bool _should_do_something_else();

////////
Expand Down
2 changes: 1 addition & 1 deletion proxy/http3/Http3Session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ HQSession::do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *buf, boo
}

void
HQSession::do_io_close(int lerrno)
HQSession::_do_io_close(int lerrno)
{
// TODO
return;
Expand Down
5 changes: 4 additions & 1 deletion proxy/http3/Http3Session.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class HQSession : public ProxySession
// Implement VConnection interface
VIO *do_io_read(Continuation *c, int64_t nbytes = INT64_MAX, MIOBuffer *buf = nullptr) override;
VIO *do_io_write(Continuation *c = nullptr, int64_t nbytes = INT64_MAX, IOBufferReader *buf = 0, bool owner = false) override;
void do_io_close(int lerrno = -1) override;
void do_io_shutdown(ShutdownHowTo_t howto) override;
void reenable(VIO *vio) override;

Expand All @@ -56,6 +55,10 @@ class HQSession : public ProxySession
void add_transaction(HQTransaction *);
HQTransaction *get_transaction(QUICStreamId);

protected:
// Implement ProxySession interface
void _do_io_close(int lerrno) override;

private:
// this should be unordered map?
Queue<HQTransaction> _transaction_list;
Expand Down