Skip to content
Merged
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
84 changes: 42 additions & 42 deletions src/proxy/http/HttpSM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ initialize_thread_for_connecting_pools(EThread *thread)
{ \
/*ink_assert (magic == HttpSmMagic_t::ALIVE); */ REMEMBER(event, reentrancy_count); \
SMDbg(dbg_ctl_http, "[%s, %s]", #state_name, HttpDebugNames::get_event_name(event)); \
ATS_PROBE1(state_name, sm_id); \
ATS_PROBE1(state_enter_##state_name, sm_id); \
}

#define HTTP_SM_SET_DEFAULT_HANDLER(_h) \
Expand Down Expand Up @@ -576,7 +576,7 @@ HttpSM::setup_blind_tunnel_port()
int
HttpSM::state_read_client_request_header(int event, void *data)
{
STATE_ENTER(&HttpSM::state_read_client_request_header, event);
STATE_ENTER(state_read_client_request_header, event);

ink_assert(_ua.get_entry()->read_vio == (VIO *)data);
ink_assert(server_entry == nullptr);
Expand Down Expand Up @@ -898,7 +898,7 @@ HttpSM::wait_for_full_body()
int
HttpSM::state_watch_for_client_abort(int event, void *data)
{
STATE_ENTER(&HttpSM::state_watch_for_client_abort, event);
STATE_ENTER(state_watch_for_client_abort, event);

ink_assert(_ua.get_entry()->read_vio == (VIO *)data || _ua.get_entry()->write_vio == (VIO *)data);
ink_assert(_ua.get_entry()->vc == _ua.get_txn());
Expand Down Expand Up @@ -1042,7 +1042,7 @@ HttpSM::setup_push_read_response_header()
int
HttpSM::state_read_push_response_header(int event, void *data)
{
STATE_ENTER(&HttpSM::state_read_push_response_header, event);
STATE_ENTER(state_read_push_response_header, event);
ink_assert(_ua.get_entry()->read_vio == (VIO *)data);
ink_assert(t_state.current.server == nullptr);

Expand Down Expand Up @@ -1138,7 +1138,7 @@ HttpSM::state_read_push_response_header(int event, void *data)
int
HttpSM::state_raw_http_server_open(int event, void *data)
{
STATE_ENTER(&HttpSM::state_raw_http_server_open, event);
STATE_ENTER(state_raw_http_server_open, event);
ink_assert(server_entry == nullptr);
ATS_PROBE1(milestone_server_connect_end, sm_id);
milestones[TS_MILESTONE_SERVER_CONNECT_END] = ink_get_hrtime();
Expand Down Expand Up @@ -1204,7 +1204,7 @@ HttpSM::state_raw_http_server_open(int event, void *data)
int
HttpSM::state_request_wait_for_transform_read(int event, void *data)
{
STATE_ENTER(&HttpSM::state_request_wait_for_transform_read, event);
STATE_ENTER(state_request_wait_for_transform_read, event);
int64_t size;

switch (event) {
Expand Down Expand Up @@ -1244,7 +1244,7 @@ HttpSM::state_request_wait_for_transform_read(int event, void *data)
int
HttpSM::state_response_wait_for_transform_read(int event, void *data)
{
STATE_ENTER(&HttpSM::state_response_wait_for_transform_read, event);
STATE_ENTER(state_response_wait_for_transform_read, event);
int64_t size = *(static_cast<int64_t *>(data));

switch (event) {
Expand Down Expand Up @@ -1274,7 +1274,7 @@ HttpSM::state_response_wait_for_transform_read(int event, void *data)
int
HttpSM::state_common_wait_for_transform_read(HttpTransformInfo *t_info, HttpSMHandler tunnel_handler, int event, void *data)
{
STATE_ENTER(&HttpSM::state_common_wait_for_transform_read, event);
STATE_ENTER(state_common_wait_for_transform_read, event);
HttpTunnelConsumer *c = nullptr;

switch (event) {
Expand Down Expand Up @@ -1374,7 +1374,7 @@ HttpSM::state_api_callback(int event, void *data)

this->milestone_update_api_time();

STATE_ENTER(&HttpSM::state_api_callback, event);
STATE_ENTER(state_api_callback, event);

state_api_callout(event, data);

Expand Down Expand Up @@ -1414,7 +1414,7 @@ HttpSM::state_api_callout(int event, void * /* data ATS_UNUSED */)
AfterApiReturn_t api_next = AfterApiReturn_t::UNKNOWN;

if (event != EVENT_NONE) {
STATE_ENTER(&HttpSM::state_api_callout, event);
STATE_ENTER(state_api_callout, event);
}

if (api_timer < 0) {
Expand Down Expand Up @@ -1846,7 +1846,7 @@ int
HttpSM::state_http_server_open(int event, void *data)
{
SMDbg(dbg_ctl_http_track, "entered inside state_http_server_open: %s", HttpDebugNames::get_event_name(event));
STATE_ENTER(&HttpSM::state_http_server_open, event);
STATE_ENTER(state_http_server_open, event);

if (event == CONNECT_EVENT_RETRY) {
pending_action.clear_if_action_is(reinterpret_cast<Action *>(data));
Expand Down Expand Up @@ -2007,7 +2007,7 @@ HttpSM::state_http_server_open(int event, void *data)
int
HttpSM::state_read_server_response_header(int event, void *data)
{
STATE_ENTER(&HttpSM::state_read_server_response_header, event);
STATE_ENTER(state_read_server_response_header, event);
// If we had already received EOS, just go away. We would sometimes see
// a WRITE event appear after receiving EOS from the server connection
if (server_entry->eos) {
Expand Down Expand Up @@ -2199,7 +2199,7 @@ HttpSM::state_send_server_request_header(int event, void *data)
ink_assert(server_entry != nullptr);
ink_assert(server_entry->eos == false);
ink_assert(server_entry->write_vio == (VIO *)data);
STATE_ENTER(&HttpSM::state_send_server_request_header, event);
STATE_ENTER(state_send_server_request_header, event);

int method;

Expand Down Expand Up @@ -2461,7 +2461,7 @@ HttpSM::process_hostdb_info(HostDBRecord *record)
int
HttpSM::state_hostdb_lookup(int event, void *data)
{
STATE_ENTER(&HttpSM::state_hostdb_lookup, event);
STATE_ENTER(state_hostdb_lookup, event);

switch (event) {
case EVENT_HOST_DB_LOOKUP:
Expand Down Expand Up @@ -2499,7 +2499,7 @@ HttpSM::state_hostdb_lookup(int event, void *data)
int
HttpSM::state_hostdb_reverse_lookup(int event, void *data)
{
STATE_ENTER(&HttpSM::state_hostdb_reverse_lookup, event);
STATE_ENTER(state_hostdb_reverse_lookup, event);

// HttpRequestFlavor_t::SCHEDULED_UPDATE can be transformed into
// HttpRequestFlavor_t::REVPROXY
Expand Down Expand Up @@ -2533,7 +2533,7 @@ HttpSM::state_hostdb_reverse_lookup(int event, void *data)
int
HttpSM::state_cache_open_write(int event, void *data)
{
STATE_ENTER(&HttpSM : state_cache_open_write, event);
STATE_ENTER(state_cache_open_write, event);

// Make sure we are on the "right" thread
if (_ua.get_txn()) {
Expand Down Expand Up @@ -2658,7 +2658,7 @@ HttpSM::setup_cache_lookup_complete_api()
int
HttpSM::state_cache_open_read(int event, void *data)
{
STATE_ENTER(&HttpSM::state_cache_open_read, event);
STATE_ENTER(state_cache_open_read, event);

pending_action.clear_if_action_is(reinterpret_cast<Action *>(data));

Expand Down Expand Up @@ -2901,7 +2901,7 @@ HttpSM::tunnel_handler_post_or_put(HttpTunnelProducer *p)
int
HttpSM::tunnel_handler_post(int event, void *data)
{
STATE_ENTER(&HttpSM::tunnel_handler_post, event);
STATE_ENTER(tunnel_handler_post, event);

HttpTunnelProducer *p =
_ua.get_txn() != nullptr ? tunnel.get_producer(_ua.get_txn()) : tunnel.get_producer(HttpTunnelType_t::HTTP_CLIENT);
Expand Down Expand Up @@ -3016,7 +3016,7 @@ HttpSM::setup_tunnel_handler_trailer(HttpTunnelProducer *p)
int
HttpSM::tunnel_handler_trailer(int event, void *data)
{
STATE_ENTER(&HttpSM::tunnel_handler_trailer, event);
STATE_ENTER(tunnel_handler_trailer, event);

switch (event) {
case HTTP_TUNNEL_EVENT_DONE: // Response tunnel done.
Expand Down Expand Up @@ -3062,7 +3062,7 @@ HttpSM::tunnel_handler_trailer(int event, void *data)
int
HttpSM::tunnel_handler_cache_fill(int event, void *data)
{
STATE_ENTER(&HttpSM::tunnel_handler_cache_fill, event);
STATE_ENTER(tunnel_handler_cache_fill, event);

ink_assert(event == HTTP_TUNNEL_EVENT_DONE);
ink_assert(data == &tunnel);
Expand Down Expand Up @@ -3103,7 +3103,7 @@ HttpSM::tunnel_handler_cache_fill(int event, void *data)
int
HttpSM::tunnel_handler_100_continue(int event, void *data)
{
STATE_ENTER(&HttpSM::tunnel_handler_100_continue, event);
STATE_ENTER(tunnel_handler_100_continue, event);

ink_assert(event == HTTP_TUNNEL_EVENT_DONE);
ink_assert(data == &tunnel);
Expand Down Expand Up @@ -3144,7 +3144,7 @@ HttpSM::tunnel_handler_100_continue(int event, void *data)
int
HttpSM::tunnel_handler_push(int event, void *data)
{
STATE_ENTER(&HttpSM::tunnel_handler_push, event);
STATE_ENTER(tunnel_handler_push, event);

ink_assert(event == HTTP_TUNNEL_EVENT_DONE);
ink_assert(data == &tunnel);
Expand Down Expand Up @@ -3182,7 +3182,7 @@ HttpSM::tunnel_handler_push(int event, void *data)
int
HttpSM::tunnel_handler(int event, void * /* data ATS_UNUSED */)
{
STATE_ENTER(&HttpSM::tunnel_handler, event);
STATE_ENTER(tunnel_handler, event);

// If we had already received EOS, just go away. We would sometimes see
// a WRITE event appear after receiving EOS from the server connection
Expand Down Expand Up @@ -3240,7 +3240,7 @@ HttpSM::is_http_server_eos_truncation(HttpTunnelProducer *p)
int
HttpSM::tunnel_handler_server(int event, HttpTunnelProducer *p)
{
STATE_ENTER(&HttpSM::tunnel_handler_server, event);
STATE_ENTER(tunnel_handler_server, event);

// An intercept handler may not set TS_MILESTONE_SERVER_CONNECT
// by default. Therefore we only set TS_MILESTONE_SERVER_CLOSE if
Expand Down Expand Up @@ -3445,7 +3445,7 @@ HttpSM::tunnel_handler_server(int event, HttpTunnelProducer *p)
int
HttpSM::tunnel_handler_trailer_server(int event, HttpTunnelProducer *p)
{
STATE_ENTER(&HttpSM::tunnel_handler_trailer_server, event);
STATE_ENTER(tunnel_handler_trailer_server, event);

switch (event) {
case VC_EVENT_INACTIVITY_TIMEOUT:
Expand Down Expand Up @@ -3529,7 +3529,7 @@ HttpSM::tunnel_handler_trailer_server(int event, HttpTunnelProducer *p)
int
HttpSM::tunnel_handler_100_continue_ua(int event, HttpTunnelConsumer *c)
{
STATE_ENTER(&HttpSM::tunnel_handler_100_continue_ua, event);
STATE_ENTER(tunnel_handler_100_continue_ua, event);

ink_assert(c->vc == _ua.get_txn());

Expand Down Expand Up @@ -3616,7 +3616,7 @@ HttpSM::tunnel_handler_ua(int event, HttpTunnelConsumer *c)
HttpTunnelProducer *p = nullptr;
HttpTunnelConsumer *selfc = nullptr;

STATE_ENTER(&HttpSM::tunnel_handler_ua, event);
STATE_ENTER(tunnel_handler_ua, event);
ink_assert(c->vc == _ua.get_txn());
ATS_PROBE1(milestone_ua_close, sm_id);
milestones[TS_MILESTONE_UA_CLOSE] = ink_get_hrtime();
Expand Down Expand Up @@ -3752,7 +3752,7 @@ HttpSM::tunnel_handler_trailer_ua(int event, HttpTunnelConsumer *c)
HttpTunnelProducer *p = nullptr;
HttpTunnelConsumer *selfc = nullptr;

STATE_ENTER(&HttpSM::tunnel_handler_trailer_ua, event);
STATE_ENTER(tunnel_handler_trailer_ua, event);
ink_assert(c->vc == _ua.get_txn());
ATS_PROBE1(milestone_ua_close, sm_id);
milestones[TS_MILESTONE_UA_CLOSE] = ink_get_hrtime();
Expand Down Expand Up @@ -3810,7 +3810,7 @@ HttpSM::tunnel_handler_trailer_ua(int event, HttpTunnelConsumer *c)
int
HttpSM::tunnel_handler_ua_push(int event, HttpTunnelProducer *p)
{
STATE_ENTER(&HttpSM::tunnel_handler_ua_push, event);
STATE_ENTER(tunnel_handler_ua_push, event);

pushed_response_body_bytes += p->bytes_read;
client_request_body_bytes += p->bytes_read;
Expand Down Expand Up @@ -3850,7 +3850,7 @@ HttpSM::tunnel_handler_ua_push(int event, HttpTunnelProducer *p)
int
HttpSM::tunnel_handler_cache_read(int event, HttpTunnelProducer *p)
{
STATE_ENTER(&HttpSM::tunnel_handler_cache_read, event);
STATE_ENTER(tunnel_handler_cache_read, event);

switch (event) {
case VC_EVENT_ERROR:
Expand Down Expand Up @@ -3890,7 +3890,7 @@ HttpSM::tunnel_handler_cache_read(int event, HttpTunnelProducer *p)
int
HttpSM::tunnel_handler_cache_write(int event, HttpTunnelConsumer *c)
{
STATE_ENTER(&HttpSM::tunnel_handler_cache_write, event);
STATE_ENTER(tunnel_handler_cache_write, event);
SMDbg(dbg_ctl_http, "handling cache event: %s", HttpDebugNames::get_event_name(event));

HttpTransact::CacheWriteStatus_t *status_ptr = (c->producer->vc_type == HttpTunnelType_t::TRANSFORM) ?
Expand Down Expand Up @@ -3948,7 +3948,7 @@ HttpSM::tunnel_handler_cache_write(int event, HttpTunnelConsumer *c)
int
HttpSM::tunnel_handler_post_ua(int event, HttpTunnelProducer *p)
{
STATE_ENTER(&HttpSM::tunnel_handler_post_ua, event);
STATE_ENTER(tunnel_handler_post_ua, event);

// Now that the tunnel is done, it can tell us how many bytes were in the
// body.
Expand Down Expand Up @@ -4052,7 +4052,7 @@ HttpSM::tunnel_handler_post_ua(int event, HttpTunnelProducer *p)
int
HttpSM::tunnel_handler_for_partial_post(int event, void * /* data ATS_UNUSED */)
{
STATE_ENTER(&HttpSM::tunnel_handler_for_partial_post, event);
STATE_ENTER(tunnel_handler_for_partial_post, event);
tunnel.deallocate_buffers();
tunnel.reset();

Expand All @@ -4072,7 +4072,7 @@ HttpSM::tunnel_handler_for_partial_post(int event, void * /* data ATS_UNUSED */)
int
HttpSM::tunnel_handler_post_server(int event, HttpTunnelConsumer *c)
{
STATE_ENTER(&HttpSM::tunnel_handler_post_server, event);
STATE_ENTER(tunnel_handler_post_server, event);

// If is_using_post_buffer has been used, then this handler gets called
// twice, once with the buffered request body bytes and a second time with
Expand Down Expand Up @@ -4193,7 +4193,7 @@ HttpSM::tunnel_handler_post_server(int event, HttpTunnelConsumer *c)
int
HttpSM::tunnel_handler_ssl_producer(int event, HttpTunnelProducer *p)
{
STATE_ENTER(&HttpSM::tunnel_handler_ssl_producer, event);
STATE_ENTER(tunnel_handler_ssl_producer, event);

switch (event) {
case VC_EVENT_READ_READY:
Expand Down Expand Up @@ -4269,7 +4269,7 @@ HttpSM::tunnel_handler_ssl_producer(int event, HttpTunnelProducer *p)
int
HttpSM::tunnel_handler_ssl_consumer(int event, HttpTunnelConsumer *c)
{
STATE_ENTER(&HttpSM::tunnel_handler_ssl_consumer, event);
STATE_ENTER(tunnel_handler_ssl_consumer, event);

switch (event) {
case VC_EVENT_ERROR:
Expand Down Expand Up @@ -4340,7 +4340,7 @@ HttpSM::tunnel_handler_ssl_consumer(int event, HttpTunnelConsumer *c)
int
HttpSM::tunnel_handler_transform_write(int event, HttpTunnelConsumer *c)
{
STATE_ENTER(&HttpSM::tunnel_handler_transform_write, event);
STATE_ENTER(tunnel_handler_transform_write, event);

HttpTransformInfo *i;

Expand Down Expand Up @@ -4425,7 +4425,7 @@ HttpSM::tunnel_handler_transform_write(int event, HttpTunnelConsumer *c)
int
HttpSM::tunnel_handler_transform_read(int event, HttpTunnelProducer *p)
{
STATE_ENTER(&HttpSM::tunnel_handler_transform_read, event);
STATE_ENTER(tunnel_handler_transform_read, event);

ink_assert(p->vc == transform_info.vc || p->vc == post_transform_info.vc);

Expand Down Expand Up @@ -4469,7 +4469,7 @@ HttpSM::tunnel_handler_transform_read(int event, HttpTunnelProducer *p)
int
HttpSM::tunnel_handler_plugin_agent(int event, HttpTunnelConsumer *c)
{
STATE_ENTER(&HttpSM::tunnel_handler_plugin_client, event);
STATE_ENTER(tunnel_handler_plugin_agent, event);

switch (event) {
case VC_EVENT_ERROR:
Expand Down Expand Up @@ -4498,7 +4498,7 @@ HttpSM::tunnel_handler_plugin_agent(int event, HttpTunnelConsumer *c)
int
HttpSM::state_remap_request(int event, void * /* data ATS_UNUSED */)
{
STATE_ENTER(&HttpSM::state_remap_request, event);
STATE_ENTER(state_remap_request, event);

switch (event) {
case EVENT_REMAP_ERROR: {
Expand Down Expand Up @@ -6211,7 +6211,7 @@ HttpSM::release_server_session(bool serve_from_cache)
void
HttpSM::handle_post_failure()
{
STATE_ENTER(&HttpSM::handle_post_failure, VC_EVENT_NONE);
STATE_ENTER(handle_post_failure, VC_EVENT_NONE);

ink_assert(_ua.get_entry()->vc == _ua.get_txn());
ink_assert(is_waiting_for_full_body || server_entry->eos == true);
Expand Down Expand Up @@ -6308,7 +6308,7 @@ HttpSM::handle_server_setup_error(int event, void *data)
VIO *vio = static_cast<VIO *>(data);
ink_assert(vio != nullptr);

STATE_ENTER(&HttpSM::handle_server_setup_error, event);
STATE_ENTER(handle_server_setup_error, event);

// If there is POST or PUT tunnel wait for the tunnel
// to figure out that things have gone to hell
Expand Down