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

Method do_io_close

src/proxy/http2/Http2Stream.cc:554–587  ·  view source on GitHub ↗

Initiated from SM

Source from the content-addressed store, hash-verified

552
553// Initiated from SM
554void
555Http2Stream::do_io_close(int /* flags */)
556{
557 SCOPED_MUTEX_LOCK(lock, this->mutex, this_ethread());
558
559 if (!closed) {
560 REMEMBER(NO_EVENT, this->reentrancy_count);
561 Http2StreamDebug("do_io_close");
562
563 // Let the other end know we are going away.
564 // We only need to do this for the client side since we only need to pass through RST_STREAM
565 // from the server. If a client sends a RST_STREAM, we need to keep the server side alive so
566 // the background fill can function as intended.
567 //
568 // In the half-closed(local) state, server can close stream actively by sending RST_STREAM frame
569 if (!this->is_outbound_connection() &&
570 (this->is_state_writeable() || _state == Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL)) {
571 this->get_connection_state().send_rst_stream_frame(_id, Http2ErrorCode::HTTP2_ERROR_NO_ERROR);
572 }
573
574 // When we get here, the SM has initiated the shutdown. Either it received a WRITE_COMPLETE, or it is shutting down. Any
575 // remaining IO operations back to client should be abandoned. The SM-side buffers backing these operations will be deleted
576 // by the time this is called from transaction_done.
577 closed = true;
578
579 // Adjust state, so we don't process any more data
580 _state = Http2StreamState::HTTP2_STREAM_STATE_CLOSED;
581
582 _clear_timers();
583 clear_io_events();
584
585 // Otherwise, Wait until transaction_done is called from HttpSM to signal that the TXN_CLOSE hook has been executed
586 }
587}
588
589/*
590 * HttpSM has called TXN_close hooks.

Calls 4

is_state_writeableMethod · 0.95
this_ethreadFunction · 0.85
send_rst_stream_frameMethod · 0.80

Tested by

no test coverage detected