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

Method tunnel_handler_ssl_consumer

src/proxy/http/HttpSM.cc:4116–4181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4114}
4115
4116int
4117HttpSM::tunnel_handler_ssl_consumer(int event, HttpTunnelConsumer *c)
4118{
4119 STATE_ENTER(&HttpSM::tunnel_handler_ssl_consumer, event);
4120
4121 switch (event) {
4122 case VC_EVENT_ERROR:
4123 case VC_EVENT_EOS:
4124 case VC_EVENT_INACTIVITY_TIMEOUT:
4125 case VC_EVENT_ACTIVE_TIMEOUT:
4126 // we need to mark the producer dead
4127 // otherwise it can stay alive forever.
4128 if (c->producer->alive) {
4129 c->producer->alive = false;
4130 if (c->producer->self_consumer->alive) {
4131 c->producer->vc->do_io_shutdown(IO_SHUTDOWN_READ);
4132 } else {
4133 tunnel.close_vc(c->producer);
4134 }
4135 }
4136 // Since we are changing the state of the self_producer
4137 // we must have the tunnel shutdown the vc
4138 tunnel.close_vc(c);
4139 tunnel.local_finish_all(c->self_producer);
4140 break;
4141
4142 case VC_EVENT_WRITE_COMPLETE:
4143 // If we get this event, it means that the producer
4144 // has finished and we wrote the remaining data
4145 // to the consumer
4146 //
4147 // If the read side of this connection has not yet
4148 // closed, do a write half-close and then wait for
4149 // read side to close so that we don't cut off
4150 // pipelined responses with TCP resets
4151 //
4152 // ink_assert(c->producer->alive == false);
4153 c->write_success = true;
4154 if (c->self_producer->alive == true) {
4155 c->vc->do_io_shutdown(IO_SHUTDOWN_WRITE);
4156 } else {
4157 c->vc->do_io_close();
4158 }
4159 break;
4160
4161 default:
4162 ink_release_assert(0);
4163 }
4164
4165 // Update stats
4166 switch (c->vc_type) {
4167 case HT_HTTP_SERVER:
4168 server_request_body_bytes += c->bytes_written;
4169 break;
4170 case HT_HTTP_CLIENT:
4171 client_response_body_bytes += c->bytes_written;
4172 break;
4173 default:

Callers

nothing calls this directly

Calls 4

close_vcMethod · 0.80
local_finish_allMethod · 0.80
do_io_shutdownMethod · 0.45
do_io_closeMethod · 0.45

Tested by

no test coverage detected