From 7c2cd43dfa035029fe8c7d16ec14e7d331a4399d Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Mon, 9 Aug 2021 21:54:04 +0900 Subject: [PATCH] Compile with the latest ngtcp2 and nghttp3 --- src/h2load.h | 1 + src/h2load_http3_session.cc | 4 ++-- src/h2load_http3_session.h | 2 +- src/h2load_quic.cc | 28 +++++++++++++++++++++++++++- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/h2load.h b/src/h2load.h index 897fd9cf..2d18fbf8 100644 --- a/src/h2load.h +++ b/src/h2load.h @@ -472,6 +472,7 @@ struct Client { 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_stream_stop_sending(int64_t stream_id, uint64_t app_error_code); int quic_extend_max_local_streams(); int quic_on_key(ngtcp2_crypto_level level, const uint8_t *rx_secret, diff --git a/src/h2load_http3_session.cc b/src/h2load_http3_session.cc index 1ce06903..40970f7a 100644 --- a/src/h2load_http3_session.cc +++ b/src/h2load_http3_session.cc @@ -252,8 +252,8 @@ int Http3Session::close_stream(int64_t stream_id, uint64_t app_error_code) { } } -int Http3Session::reset_stream(int64_t stream_id) { - auto rv = nghttp3_conn_reset_stream(conn_, stream_id); +int Http3Session::shutdown_stream_read(int64_t stream_id) { + auto rv = nghttp3_conn_shutdown_stream_read(conn_, stream_id); if (rv != 0) { return -1; } diff --git a/src/h2load_http3_session.h b/src/h2load_http3_session.h index db6c4244..27ff025b 100644 --- a/src/h2load_http3_session.h +++ b/src/h2load_http3_session.h @@ -54,7 +54,7 @@ public: int send_stop_sending(int64_t stream_id, uint64_t app_error_code); int close_stream(int64_t stream_id, uint64_t app_error_code); - int reset_stream(int64_t stream_id); + int shutdown_stream_read(int64_t stream_id); int extend_max_local_streams(); int64_t submit_request_internal(); diff --git a/src/h2load_quic.cc b/src/h2load_quic.cc index b131e1ac..17f4f73c 100644 --- a/src/h2load_quic.cc +++ b/src/h2load_quic.cc @@ -141,7 +141,28 @@ int stream_reset(ngtcp2_conn *conn, int64_t stream_id, uint64_t final_size, int Client::quic_stream_reset(int64_t stream_id, uint64_t app_error_code) { auto s = static_cast(session.get()); - if (s->reset_stream(stream_id) != 0) { + if (s->shutdown_stream_read(stream_id) != 0) { + return -1; + } + return 0; +} + +namespace { +int stream_stop_sending(ngtcp2_conn *conn, int64_t stream_id, + uint64_t app_error_code, void *user_data, + void *stream_user_data) { + auto c = static_cast(user_data); + if (c->quic_stream_stop_sending(stream_id, app_error_code) != 0) { + return -1; + } + return 0; +} +} // namespace + +int Client::quic_stream_stop_sending(int64_t stream_id, + uint64_t app_error_code) { + auto s = static_cast(session.get()); + if (s->shutdown_stream_read(stream_id) != 0) { return -1; } return 0; @@ -327,6 +348,11 @@ int Client::quic_init(const sockaddr *local_addr, socklen_t local_addrlen, nullptr, // recv_new_token ngtcp2_crypto_delete_crypto_aead_ctx_cb, ngtcp2_crypto_delete_crypto_cipher_ctx_cb, + nullptr, // recv_datagram + nullptr, // ack_datagram + nullptr, // lost_datagram + nullptr, // get_path_challenge_data + h2load::stream_stop_sending, }; ngtcp2_cid scid, dcid;