MCPcopy Create free account
hub / github.com/apache/trafficserver / ~Http2Stream

Method ~Http2Stream

src/proxy/http2/Http2Stream.cc:86–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86Http2Stream::~Http2Stream()
87{
88 REMEMBER(NO_EVENT, this->reentrancy_count);
89 Http2StreamDebug("Destroy stream, sent %" PRIu64 " bytes, registered: %s", this->bytes_sent,
90 (_registered_stream ? "true" : "false"));
91
92 // In the case of a temporary stream used to parse the header to keep the HPACK
93 // up to date, there may not be a mutex. Nothing was set up, so nothing to
94 // clean up in the destructor
95 if (this->mutex == nullptr) {
96 return;
97 }
98
99 SCOPED_MUTEX_LOCK(lock, this->mutex, this_ethread());
100 // Clean up after yourself if this was an EOS
101 ink_release_assert(this->closed);
102 ink_release_assert(reentrancy_count == 0);
103
104 uint64_t cid = 0;
105
106 if (_registered_stream) {
107 // Safe to initiate SSN_CLOSE if this is the last stream
108 if (_proxy_ssn) {
109 cid = _proxy_ssn->connection_id();
110
111 SCOPED_MUTEX_LOCK(lock, _proxy_ssn->mutex, this_ethread());
112 Http2ConnectionState &connection_state = this->get_connection_state();
113
114 // Make sure the stream is removed from the stream list and priority tree
115 // In many cases, this has been called earlier, so this call is a no-op
116 connection_state.delete_stream(this);
117
118 connection_state.decrement_peer_stream_count();
119
120 // Update session's stream counts, so it accurately goes into keep-alive state
121 connection_state.release_stream();
122
123 // Do not access `_proxy_ssn` in below. It might be freed by `release_stream`.
124 }
125 } // Otherwise, not registered with the connection_state (i.e. a temporary stream used for HPACK header processing)
126
127 // Clean up the write VIO in case of inactivity timeout
128 this->do_io_write(nullptr, 0, nullptr);
129
130 this->_milestones.mark(Http2StreamMilestone::CLOSE);
131
132 ink_hrtime total_time = this->_milestones.elapsed(Http2StreamMilestone::OPEN, Http2StreamMilestone::CLOSE);
133 Metrics::Counter::increment(http2_rsb.total_transactions_time, total_time);
134
135 // Slow Log
136 if (Http2::stream_slow_log_threshold != 0 && ink_hrtime_from_msec(Http2::stream_slow_log_threshold) < total_time) {
137 Error("[%" PRIu64 "] [%" PRIu32 "] [%" PRId64 "] Slow H2 Stream: "
138 "open: %" PRIu64 " "
139 "dec_hdrs: %.3f "
140 "txn: %.3f "
141 "enc_hdrs: %.3f "
142 "tx_hdrs: %.3f "
143 "tx_data: %.3f "

Callers

nothing calls this directly

Calls 15

do_io_writeMethod · 0.95
this_ethreadFunction · 0.85
incrementFunction · 0.85
ink_hrtime_from_msecFunction · 0.85
ink_hrtime_to_msecFunction · 0.85
ats_freeFunction · 0.85
http_parser_clearFunction · 0.85
release_streamMethod · 0.80
difference_secMethod · 0.80
ErrorClass · 0.50
connection_idMethod · 0.45

Tested by

no test coverage detected