diff --git a/src/h2load.h b/src/h2load.h index c65f3f0f..e01a3c8c 100644 --- a/src/h2load.h +++ b/src/h2load.h @@ -461,6 +461,7 @@ struct Client { int quic_handshake_completed(); int quic_recv_stream_data(int64_t stream_id, int fin, const uint8_t *data, size_t datalen); + int quic_acked_stream_data_offset(int64_t stream_id, size_t datalen); int quic_stream_close(int64_t stream_id, uint64_t app_error_code); int quic_stream_reset(int64_t stream_id, uint64_t app_error_code); int quic_extend_max_local_streams(); diff --git a/src/h2load_http3_session.cc b/src/h2load_http3_session.cc index ca4bbe05..f15168c0 100644 --- a/src/h2load_http3_session.cc +++ b/src/h2load_http3_session.cc @@ -373,4 +373,13 @@ int Http3Session::add_write_offset(int64_t stream_id, size_t ndatalen) { return 0; } +int Http3Session::add_ack_offset(int64_t stream_id, size_t datalen) { + auto rv = nghttp3_conn_add_ack_offset(conn_, stream_id, datalen); + if (rv != 0) { + client_->quic.last_error = quic::err_application(rv); + return -1; + } + return 0; +} + } // namespace h2load diff --git a/src/h2load_http3_session.h b/src/h2load_http3_session.h index f62b219d..48b4f80c 100644 --- a/src/h2load_http3_session.h +++ b/src/h2load_http3_session.h @@ -64,6 +64,7 @@ public: size_t veccnt); int block_stream(int64_t stream_id); int add_write_offset(int64_t stream_id, size_t ndatalen); + int add_ack_offset(int64_t stream_id, size_t datalen); private: Client *client_; diff --git a/src/h2load_quic.cc b/src/h2load_quic.cc index c43ab310..984b0bd9 100644 --- a/src/h2load_quic.cc +++ b/src/h2load_quic.cc @@ -126,6 +126,26 @@ int Client::quic_recv_stream_data(int64_t stream_id, int fin, return 0; } +namespace { +int acked_stream_data_offset(ngtcp2_conn *conn, int64_t stream_id, + uint64_t offset, size_t datalen, void *user_data, + void *stream_user_data) { + auto c = static_cast(user_data); + if (c->quic_acked_stream_data_offset(stream_id, datalen) != 0) { + return NGTCP2_ERR_CALLBACK_FAILURE; + } + return 0; +} +} // namespace + +int Client::quic_acked_stream_data_offset(int64_t stream_id, size_t datalen) { + auto s = static_cast(session.get()); + if (s->add_ack_offset(stream_id, datalen) != 0) { + return -1; + } + return 0; +} + namespace { int stream_close(ngtcp2_conn *conn, int64_t stream_id, uint64_t app_error_code, void *user_data, void *stream_user_data) { @@ -331,7 +351,7 @@ int Client::quic_init(const sockaddr *local_addr, socklen_t local_addrlen, ngtcp2_crypto_hp_mask_cb, h2load::recv_stream_data, nullptr, // acked_crypto_offset - nullptr, // acked_stream_data_offset + h2load::acked_stream_data_offset, nullptr, // stream_open h2load::stream_close, nullptr, // recv_stateless_reset