From fa8c16ae0152747eaa448e3aa946b2f9124d953d Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Mon, 7 Dec 2020 22:31:58 +0900 Subject: [PATCH] Compile with the latest ngtcp2 and nghttp3 --- src/h2load_http3_session.cc | 6 +++--- src/h2load_quic.cc | 28 +++++++--------------------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/src/h2load_http3_session.cc b/src/h2load_http3_session.cc index 24e99b9d..ca36a3a8 100644 --- a/src/h2load_http3_session.cc +++ b/src/h2load_http3_session.cc @@ -289,7 +289,7 @@ int Http3Session::init_conn() { return -1; } - nghttp3_conn_callbacks callbacks{ + nghttp3_callbacks callbacks{ nullptr, // acked_stream_data h2load::stream_close, h2load::recv_data, @@ -310,8 +310,8 @@ int Http3Session::init_conn() { auto config = client_->worker->config; - nghttp3_conn_settings settings; - nghttp3_conn_settings_default(&settings); + nghttp3_settings settings; + nghttp3_settings_default(&settings); settings.qpack_max_table_capacity = config->header_table_size; settings.qpack_blocked_streams = 100; diff --git a/src/h2load_quic.cc b/src/h2load_quic.cc index 8863238f..5231666d 100644 --- a/src/h2load_quic.cc +++ b/src/h2load_quic.cc @@ -26,6 +26,8 @@ #include +#include + #include #include "h2load_http3_session.h" @@ -233,31 +235,14 @@ ngtcp2_tstamp timestamp(struct ev_loop *loop) { } } // namespace -namespace { -ngtcp2_crypto_level from_ossl_level(OSSL_ENCRYPTION_LEVEL ossl_level) { - switch (ossl_level) { - case ssl_encryption_initial: - return NGTCP2_CRYPTO_LEVEL_INITIAL; - case ssl_encryption_early_data: - return NGTCP2_CRYPTO_LEVEL_EARLY; - case ssl_encryption_handshake: - return NGTCP2_CRYPTO_LEVEL_HANDSHAKE; - case ssl_encryption_application: - return NGTCP2_CRYPTO_LEVEL_APPLICATION; - default: - assert(0); - } -} -} // namespace - namespace { int set_encryption_secrets(SSL *ssl, OSSL_ENCRYPTION_LEVEL ossl_level, const uint8_t *rx_secret, const uint8_t *tx_secret, size_t secret_len) { auto c = static_cast(SSL_get_app_data(ssl)); - if (c->quic_on_key(from_ossl_level(ossl_level), rx_secret, tx_secret, - secret_len) != 0) { + if (c->quic_on_key(ngtcp2_crypto_from_ossl_encryption_level(ossl_level), + rx_secret, tx_secret, secret_len) != 0) { return 0; } @@ -269,7 +254,8 @@ namespace { int add_handshake_data(SSL *ssl, OSSL_ENCRYPTION_LEVEL ossl_level, const uint8_t *data, size_t len) { auto c = static_cast(SSL_get_app_data(ssl)); - c->quic_write_client_handshake(from_ossl_level(ossl_level), data, len); + c->quic_write_client_handshake( + ngtcp2_crypto_from_ossl_encryption_level(ossl_level), data, len); return 1; } } // namespace @@ -318,7 +304,7 @@ int Client::quic_init(const sockaddr *local_addr, socklen_t local_addrlen, return -1; } - auto callbacks = ngtcp2_conn_callbacks{ + auto callbacks = ngtcp2_callbacks{ ngtcp2_crypto_client_initial_cb, nullptr, // recv_client_initial h2load::recv_crypto_data,