h2load: Fix bug that ttfb is not recorded if h3 stream has no data

This commit is contained in:
Tatsuhiro Tsujikawa
2023-12-27 19:48:26 +09:00
parent 7209bff091
commit 04a14ee3e2
2 changed files with 19 additions and 1 deletions

View File

@@ -147,6 +147,23 @@ int Http3Session::stream_close(int64_t stream_id, uint64_t app_error_code) {
return 0;
}
namespace {
int end_stream(nghttp3_conn *conn, int64_t stream_id, void *user_data,
void *stream_user_data) {
auto s = static_cast<Http3Session *>(user_data);
if (s->end_stream(stream_id) != 0) {
return NGHTTP3_ERR_CALLBACK_FAILURE;
}
return 0;
}
} // namespace
int Http3Session::end_stream(int64_t stream_id) {
client_->record_ttfb();
return 0;
}
namespace {
int recv_data(nghttp3_conn *conn, int64_t stream_id, const uint8_t *data,
size_t datalen, void *user_data, void *stream_user_data) {
@@ -321,7 +338,7 @@ int Http3Session::init_conn() {
h2load::recv_header,
nullptr, // end_trailers
h2load::stop_sending,
nullptr, // end_stream
h2load::end_stream,
h2load::reset_stream,
nullptr, // shutdown
};

View File

@@ -46,6 +46,7 @@ public:
int init_conn();
int stream_close(int64_t stream_id, uint64_t app_error_code);
int end_stream(int64_t stream_id);
void recv_data(int64_t stream_id, const uint8_t *data, size_t datalen);
void consume(int64_t stream_id, size_t nconsumed);
void begin_headers(int64_t stream_id);