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

Method tunnel_handler_server

src/proxy/http/HttpSM.cc:3099–3298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3097}
3098
3099int
3100HttpSM::tunnel_handler_server(int event, HttpTunnelProducer *p)
3101{
3102 STATE_ENTER(&HttpSM::tunnel_handler_server, event);
3103
3104 // An intercept handler may not set TS_MILESTONE_SERVER_CONNECT
3105 // by default. Therefore we only set TS_MILESTONE_SERVER_CLOSE if
3106 // TS_MILESTONE_SERVER_CONNECT is set (non-zero), lest certain time
3107 // statistics are calculated from epoch time.
3108 if (0 != milestones[TS_MILESTONE_SERVER_CONNECT]) {
3109 ATS_PROBE1(milestone_server_close, sm_id);
3110 milestones[TS_MILESTONE_SERVER_CLOSE] = ink_get_hrtime();
3111 }
3112
3113 bool close_connection = false;
3114
3115 if (t_state.current.server->keep_alive == HTTP_KEEPALIVE && server_entry->eos == false &&
3116 plugin_tunnel_type == HTTP_NO_PLUGIN_TUNNEL && t_state.txn_conf->keep_alive_enabled_out == 1) {
3117 close_connection = false;
3118 } else {
3119 if (t_state.current.server->keep_alive != HTTP_KEEPALIVE) {
3120 Metrics::Counter::increment(http_rsb.origin_shutdown_tunnel_server_no_keep_alive);
3121 } else if (server_entry->eos == true) {
3122 Metrics::Counter::increment(http_rsb.origin_shutdown_tunnel_server_eos);
3123 } else {
3124 Metrics::Counter::increment(http_rsb.origin_shutdown_tunnel_server_plugin_tunnel);
3125 }
3126 close_connection = true;
3127 }
3128
3129 switch (event) {
3130 case VC_EVENT_INACTIVITY_TIMEOUT:
3131 case VC_EVENT_ACTIVE_TIMEOUT:
3132 case VC_EVENT_ERROR:
3133 t_state.squid_codes.log_code = SQUID_LOG_ERR_READ_TIMEOUT;
3134 t_state.squid_codes.hier_code = SQUID_HIER_TIMEOUT_DIRECT;
3135 /* fallthru */
3136
3137 case VC_EVENT_EOS:
3138
3139 switch (event) {
3140 case VC_EVENT_INACTIVITY_TIMEOUT:
3141 t_state.current.server->state = HttpTransact::INACTIVE_TIMEOUT;
3142 break;
3143 case VC_EVENT_ACTIVE_TIMEOUT:
3144 t_state.current.server->state = HttpTransact::ACTIVE_TIMEOUT;
3145 break;
3146 case VC_EVENT_ERROR:
3147 t_state.current.server->state = HttpTransact::CONNECTION_ERROR;
3148 break;
3149 case VC_EVENT_EOS:
3150 t_state.current.server->state = HttpTransact::TRANSACTION_COMPLETE;
3151 break;
3152 }
3153 Metrics::Counter::increment(http_rsb.origin_shutdown_tunnel_server);
3154 close_connection = true;
3155
3156 ink_assert(p->vc_type == HT_HTTP_SERVER);

Callers

nothing calls this directly

Calls 14

ink_get_hrtimeFunction · 0.85
incrementFunction · 0.85
chain_abort_allMethod · 0.80
local_finish_allMethod · 0.80
get_txnMethod · 0.80
get_proxy_ssnMethod · 0.80
remove_entryMethod · 0.45
do_io_closeMethod · 0.45
attach_server_sessionMethod · 0.45

Tested by

no test coverage detected