Compile with the latest ngtcp2 and nghttp3

This commit is contained in:
Tatsuhiro Tsujikawa 2021-08-09 21:54:04 +09:00
parent de5feff720
commit 7c2cd43dfa
4 changed files with 31 additions and 4 deletions

View File

@ -472,6 +472,7 @@ struct Client {
int quic_acked_stream_data_offset(int64_t stream_id, 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_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_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_extend_max_local_streams();
int quic_on_key(ngtcp2_crypto_level level, const uint8_t *rx_secret, int quic_on_key(ngtcp2_crypto_level level, const uint8_t *rx_secret,

View File

@ -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) { int Http3Session::shutdown_stream_read(int64_t stream_id) {
auto rv = nghttp3_conn_reset_stream(conn_, stream_id); auto rv = nghttp3_conn_shutdown_stream_read(conn_, stream_id);
if (rv != 0) { if (rv != 0) {
return -1; return -1;
} }

View File

@ -54,7 +54,7 @@ public:
int send_stop_sending(int64_t stream_id, uint64_t app_error_code); 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 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(); int extend_max_local_streams();
int64_t submit_request_internal(); int64_t submit_request_internal();

View File

@ -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) { int Client::quic_stream_reset(int64_t stream_id, uint64_t app_error_code) {
auto s = static_cast<Http3Session *>(session.get()); auto s = static_cast<Http3Session *>(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<Client *>(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<Http3Session *>(session.get());
if (s->shutdown_stream_read(stream_id) != 0) {
return -1; return -1;
} }
return 0; return 0;
@ -327,6 +348,11 @@ int Client::quic_init(const sockaddr *local_addr, socklen_t local_addrlen,
nullptr, // recv_new_token nullptr, // recv_new_token
ngtcp2_crypto_delete_crypto_aead_ctx_cb, ngtcp2_crypto_delete_crypto_aead_ctx_cb,
ngtcp2_crypto_delete_crypto_cipher_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; ngtcp2_cid scid, dcid;