MCPcopy Create free account
hub / github.com/apache/trafficserver / state_raw_http_server_open

Method state_raw_http_server_open

src/proxy/http/HttpSM.cc:1093–1150  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////////////// HttpSM::state_raw_http_server_open() /////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

1091//
1092//////////////////////////////////////////////////////////////////////////////
1093int
1094HttpSM::state_raw_http_server_open(int event, void *data)
1095{
1096 STATE_ENTER(&HttpSM::state_raw_http_server_open, event);
1097 ink_assert(server_entry == nullptr);
1098 ATS_PROBE1(milestone_server_connect_end, sm_id);
1099 milestones[TS_MILESTONE_SERVER_CONNECT_END] = ink_get_hrtime();
1100 NetVConnection *netvc = nullptr;
1101
1102 pending_action = nullptr;
1103 switch (event) {
1104 case NET_EVENT_OPEN: {
1105 // Record the VC in our table
1106 server_entry = vc_table.new_entry();
1107 server_entry->vc = netvc = static_cast<NetVConnection *>(data);
1108 server_entry->vc_type = HTTP_RAW_SERVER_VC;
1109 t_state.current.state = HttpTransact::CONNECTION_ALIVE;
1110 ats_ip_copy(&t_state.server_info.src_addr, netvc->get_local_addr());
1111
1112 netvc->set_inactivity_timeout(get_server_inactivity_timeout());
1113 netvc->set_active_timeout(get_server_active_timeout());
1114 t_state.current.server->clear_connect_fail();
1115
1116 if (get_tunnel_type() != SNIRoutingType::NONE) {
1117 tunnel.mark_tls_tunnel_active();
1118 }
1119
1120 break;
1121 }
1122 case VC_EVENT_ERROR:
1123 case VC_EVENT_EOS:
1124 case NET_EVENT_OPEN_FAILED:
1125 if (t_state.cause_of_death_errno == -UNKNOWN_INTERNAL_ERROR) {
1126 if (event == VC_EVENT_EOS) {
1127 t_state.set_connect_fail(EPIPE);
1128 } else {
1129 t_state.set_connect_fail(EIO);
1130 }
1131 }
1132 t_state.current.state = HttpTransact::OPEN_RAW_ERROR;
1133 // use this value just to get around other values
1134 t_state.hdr_info.response_error = HttpTransact::STATUS_CODE_SERVER_ERROR;
1135 break;
1136 case EVENT_INTERVAL:
1137 // If we get EVENT_INTERNAL it means that we moved the transaction
1138 // to a different thread in do_http_server_open. Since we didn't
1139 // do any of the actual work in do_http_server_open, we have to
1140 // go back and do it now.
1141 do_http_server_open(true);
1142 return 0;
1143 default:
1144 ink_release_assert(0);
1145 break;
1146 }
1147
1148 call_transact_and_set_next_state(HttpTransact::OriginServerRawOpen);
1149 return 0;
1150}

Callers

nothing calls this directly

Calls 9

ink_get_hrtimeFunction · 0.85
ats_ip_copyFunction · 0.85
new_entryMethod · 0.80
clear_connect_failMethod · 0.80
set_connect_failMethod · 0.80
get_local_addrMethod · 0.45
set_active_timeoutMethod · 0.45

Tested by

no test coverage detected