This is an automated email from the ASF dual-hosted git repository. masaori pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push: new 6492243083 Cleanup: Http2ConnectionState (#11235) 6492243083 is described below commit 6492243083d2f27eb8b16ddb8085035cf5c5b373 Author: Masaori Koshiba <masa...@apache.org> AuthorDate: Tue Apr 16 09:47:42 2024 +0900 Cleanup: Http2ConnectionState (#11235) * Cleanup: Http2ConnectionState * Fix http2_rst_stream AuTest --- src/proxy/http2/Http2ConnectionState.cc | 26 +++++++++++++------------- tests/gold_tests/h2/http2_rst_stream.test.py | 10 ++++------ 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/proxy/http2/Http2ConnectionState.cc b/src/proxy/http2/Http2ConnectionState.cc index c15102e3c5..62edea507a 100644 --- a/src/proxy/http2/Http2ConnectionState.cc +++ b/src/proxy/http2/Http2ConnectionState.cc @@ -663,7 +663,7 @@ Http2ConnectionState::rcv_rst_stream_frame(const Http2Frame &frame) } if (stream != nullptr) { - Http2StreamDebug(this->session, stream_id, "Parsed RST_STREAM: Error Code: %u", rst_stream.error_code); + Http2StreamDebug(this->session, stream_id, "Parsed RST_STREAM frame: Error Code: %u", rst_stream.error_code); stream->set_rx_error_code({ProxyErrorClass::TXN, static_cast<uint32_t>(rst_stream.error_code)}); stream->initiating_close(); } @@ -1433,7 +1433,7 @@ Http2ConnectionState::rcv_frame(const Http2Frame *frame) this->send_goaway_frame(this->latest_streamid_in, error.code); this->session->set_half_close_local_flag(true); if (fini_event == nullptr) { - fini_event = this_ethread()->schedule_imm_local((Continuation *)this, HTTP2_SESSION_EVENT_FINI); + fini_event = this_ethread()->schedule_imm_local(static_cast<Continuation *>(this), HTTP2_SESSION_EVENT_FINI); } // The streams will be cleaned up by the HTTP2_SESSION_EVENT_FINI event @@ -1510,7 +1510,8 @@ Http2ConnectionState::main_event_handler(int event, void *edata) // identifier set to 2^31-1 and a NO_ERROR code. send_goaway_frame(INT32_MAX, Http2ErrorCode::HTTP2_ERROR_NO_ERROR); // After allowing time for any in-flight stream creation (at least one round-trip time), - shutdown_cont_event = this_ethread()->schedule_in((Continuation *)this, HRTIME_SECONDS(2), HTTP2_SESSION_EVENT_SHUTDOWN_CONT); + shutdown_cont_event = + this_ethread()->schedule_in(static_cast<Continuation *>(this), HRTIME_SECONDS(2), HTTP2_SESSION_EVENT_SHUTDOWN_CONT); } break; // Continue a graceful shutdown @@ -2080,7 +2081,7 @@ Http2ConnectionState::schedule_stream_to_send_priority_frames(Http2Stream *strea _priority_scheduled = true; SET_HANDLER(&Http2ConnectionState::main_event_handler); - this_ethread()->schedule_imm_local((Continuation *)this, HTTP2_SESSION_EVENT_PRIO); + this_ethread()->schedule_imm_local(static_cast<Continuation *>(this), HTTP2_SESSION_EVENT_PRIO); } } @@ -2095,7 +2096,7 @@ Http2ConnectionState::schedule_stream_to_send_data_frames(Http2Stream *stream) _data_scheduled = true; SET_HANDLER(&Http2ConnectionState::main_event_handler); - this_ethread()->schedule_in((Continuation *)this, HRTIME_MSECOND, HTTP2_SESSION_EVENT_DATA); + this_ethread()->schedule_in(static_cast<Continuation *>(this), HRTIME_MSECOND, HTTP2_SESSION_EVENT_DATA); } } @@ -2107,14 +2108,14 @@ Http2ConnectionState::schedule_retransmit(ink_hrtime t) if (retransmit_event == nullptr) { SET_HANDLER(&Http2ConnectionState::main_event_handler); - retransmit_event = this_ethread()->schedule_in((Continuation *)this, t, HTTP2_SESSION_EVENT_XMIT); + retransmit_event = this_ethread()->schedule_in(static_cast<Continuation *>(this), t, HTTP2_SESSION_EVENT_XMIT); } } void Http2ConnectionState::cancel_retransmit() { - Http2StreamDebug(session, 0, "Scheduling retransmitting data frames"); + Http2StreamDebug(session, 0, "Canceling retransmitting data frames"); SCOPED_MUTEX_LOCK(lock, this->mutex, this_ethread()); if (retransmit_event != nullptr) { retransmit_event->cancel(); @@ -2164,7 +2165,7 @@ Http2ConnectionState::send_data_frames_depends_on_priority() break; } - this_ethread()->schedule_imm_local((Continuation *)this, HTTP2_SESSION_EVENT_PRIO); + this_ethread()->schedule_imm_local(static_cast<Continuation *>(this), HTTP2_SESSION_EVENT_PRIO); return; } @@ -2401,7 +2402,7 @@ Http2ConnectionState::send_headers_frame(Http2Stream *stream) this->send_goaway_frame(this->latest_streamid_in, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR); this->session->set_half_close_local_flag(true); if (fini_event == nullptr) { - fini_event = this_ethread()->schedule_imm_local((Continuation *)this, HTTP2_SESSION_EVENT_FINI); + fini_event = this_ethread()->schedule_imm_local(static_cast<Continuation *>(this), HTTP2_SESSION_EVENT_FINI); } return; @@ -2539,7 +2540,7 @@ Http2ConnectionState::send_push_promise_frame(Http2Stream *stream, URL &url, con void Http2ConnectionState::send_rst_stream_frame(Http2StreamId id, Http2ErrorCode ec) { - Http2StreamDebug(session, id, "Send RST_STREAM frame"); + Http2StreamDebug(session, id, "Send RST_STREAM frame: Error Code: %u", static_cast<uint32_t>(ec)); if (ec != Http2ErrorCode::HTTP2_ERROR_NO_ERROR) { Metrics::Counter::increment(http2_rsb.stream_errors_count); @@ -2554,14 +2555,13 @@ Http2ConnectionState::send_rst_stream_frame(Http2StreamId id, Http2ErrorCode ec) this->send_goaway_frame(this->latest_streamid_in, Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR); this->session->set_half_close_local_flag(true); if (fini_event == nullptr) { - fini_event = this_ethread()->schedule_imm_local((Continuation *)this, HTTP2_SESSION_EVENT_FINI); + fini_event = this_ethread()->schedule_imm_local(static_cast<Continuation *>(this), HTTP2_SESSION_EVENT_FINI); } return; } } - Http2StreamDebug(session, id, "Sending RST_STREAM: Error Code: %u", static_cast<uint32_t>(ec)); Http2RstStreamFrame rst_stream(id, static_cast<uint32_t>(ec)); this->session->xmit(rst_stream); } @@ -2647,7 +2647,7 @@ Http2ConnectionState::send_goaway_frame(Http2StreamId id, Http2ErrorCode ec) { ink_assert(this->session != nullptr); - Http2ConDebug(session, "Send GOAWAY frame, last_stream_id: %d", id); + Http2ConDebug(session, "Send GOAWAY frame: Error Code: %u, Last Stream Id: %d", static_cast<uint32_t>(ec), id); if (ec != Http2ErrorCode::HTTP2_ERROR_NO_ERROR) { Metrics::Counter::increment(http2_rsb.connection_errors_count); diff --git a/tests/gold_tests/h2/http2_rst_stream.test.py b/tests/gold_tests/h2/http2_rst_stream.test.py index e83e3064c0..caf2a71141 100644 --- a/tests/gold_tests/h2/http2_rst_stream.test.py +++ b/tests/gold_tests/h2/http2_rst_stream.test.py @@ -66,7 +66,7 @@ ts.Disk.traffic_out.Content += Testers.ContainsExpression('Received DATA frame', ts.Disk.traffic_out.Content += Testers.ContainsExpression('Received RST_STREAM frame', 'Received RST_STREAM frame.') -ts.Disk.traffic_out.Content += Testers.ContainsExpression('RST_STREAM: Error Code: 2', 'Error Code: ') +ts.Disk.traffic_out.Content += Testers.ContainsExpression('Parsed RST_STREAM frame: Error Code: 2', 'Error Code: ') # # Client sends RST_STREAM after HEADERS frame @@ -110,7 +110,7 @@ ts.Disk.traffic_out.Content += Testers.ExcludesExpression('Received DATA frame', ts.Disk.traffic_out.Content += Testers.ContainsExpression('Received RST_STREAM frame', 'Received RST_STREAM frame.') -ts.Disk.traffic_out.Content += Testers.ContainsExpression('RST_STREAM: Error Code: 5', 'Error Code: ') +ts.Disk.traffic_out.Content += Testers.ContainsExpression('Parsed RST_STREAM frame: Error Code: 5', 'Error Code: ') # # Server sends RST_STREAM after HEADERS frame @@ -147,8 +147,6 @@ server.Streams.All += "gold/server_after_headers.gold" ts.Disk.traffic_out.Content += Testers.ContainsExpression('Received RST_STREAM frame', 'Received RST_STREAM frame.') -ts.Disk.traffic_out.Content += Testers.ContainsExpression('Send RST_STREAM frame', 'Send RST_STREAM frame.') +ts.Disk.traffic_out.Content += Testers.ContainsExpression('Parsed RST_STREAM frame: Error Code: 11', 'Error Code: ') -ts.Disk.traffic_out.Content += Testers.ContainsExpression('Parsed RST_STREAM: Error Code: 11', 'Error Code: ') - -ts.Disk.traffic_out.Content += Testers.ContainsExpression('Sending RST_STREAM: Error Code: 0', 'Error Code: ') +ts.Disk.traffic_out.Content += Testers.ContainsExpression('Send RST_STREAM frame: Error Code: 0', 'Error Code: ')