mirror of
https://github.com/nghttp2/nghttp2.git
synced 2025-12-06 18:18:52 +08:00
h2load: Fix bug that ttfb is not recorded if h3 stream has no data
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user