From dc3ca53a8e7a789a870bd36490038faf0014f865 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 17 Mar 2021 18:47:54 +0900 Subject: [PATCH] Adopt ngtcp2_crypto_recv_crypto_data_cb --- src/h2load.h | 2 -- src/h2load_quic.cc | 22 +--------------------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/src/h2load.h b/src/h2load.h index 431cd999..897fd9cf 100644 --- a/src/h2load.h +++ b/src/h2load.h @@ -466,8 +466,6 @@ struct Client { size_t datalen, size_t gso_size); void quic_close_connection(); - int quic_recv_crypto_data(ngtcp2_crypto_level crypto_level, - const uint8_t *data, size_t datalen); int quic_handshake_completed(); int quic_recv_stream_data(uint32_t flags, int64_t stream_id, const uint8_t *data, size_t datalen); diff --git a/src/h2load_quic.cc b/src/h2load_quic.cc index 31e2d562..f0abd826 100644 --- a/src/h2load_quic.cc +++ b/src/h2load_quic.cc @@ -40,26 +40,6 @@ namespace { auto randgen = util::make_mt19937(); } // namespace -namespace { -int recv_crypto_data(ngtcp2_conn *conn, ngtcp2_crypto_level crypto_level, - uint64_t offset, const uint8_t *data, size_t datalen, - void *user_data) { - auto c = static_cast(user_data); - - if (c->quic_recv_crypto_data(crypto_level, data, datalen) != 0) { - return NGTCP2_ERR_CRYPTO; - } - - return 0; -} -} // namespace - -int Client::quic_recv_crypto_data(ngtcp2_crypto_level crypto_level, - const uint8_t *data, size_t datalen) { - return ngtcp2_crypto_read_write_crypto_data(quic.conn, crypto_level, data, - datalen); -} - namespace { int handshake_completed(ngtcp2_conn *conn, void *user_data) { auto c = static_cast(user_data); @@ -324,7 +304,7 @@ int Client::quic_init(const sockaddr *local_addr, socklen_t local_addrlen, auto callbacks = ngtcp2_callbacks{ ngtcp2_crypto_client_initial_cb, nullptr, // recv_client_initial - h2load::recv_crypto_data, + ngtcp2_crypto_recv_crypto_data_cb, h2load::handshake_completed, nullptr, // recv_version_negotiation ngtcp2_crypto_encrypt_cb,