Adopt ngtcp2_crypto_recv_crypto_data_cb

This commit is contained in:
Tatsuhiro Tsujikawa 2021-03-17 18:47:54 +09:00
parent bc53624133
commit 05f3b8fa0f
2 changed files with 1 additions and 23 deletions

View File

@ -466,8 +466,6 @@ struct Client {
size_t datalen, size_t gso_size); size_t datalen, size_t gso_size);
void quic_close_connection(); 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_handshake_completed();
int quic_recv_stream_data(uint32_t flags, int64_t stream_id, int quic_recv_stream_data(uint32_t flags, int64_t stream_id,
const uint8_t *data, size_t datalen); const uint8_t *data, size_t datalen);

View File

@ -40,26 +40,6 @@ namespace {
auto randgen = util::make_mt19937(); auto randgen = util::make_mt19937();
} // namespace } // 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<Client *>(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 { namespace {
int handshake_completed(ngtcp2_conn *conn, void *user_data) { int handshake_completed(ngtcp2_conn *conn, void *user_data) {
auto c = static_cast<Client *>(user_data); auto c = static_cast<Client *>(user_data);
@ -324,7 +304,7 @@ int Client::quic_init(const sockaddr *local_addr, socklen_t local_addrlen,
auto callbacks = ngtcp2_callbacks{ auto callbacks = ngtcp2_callbacks{
ngtcp2_crypto_client_initial_cb, ngtcp2_crypto_client_initial_cb,
nullptr, // recv_client_initial nullptr, // recv_client_initial
h2load::recv_crypto_data, ngtcp2_crypto_recv_crypto_data_cb,
h2load::handshake_completed, h2load::handshake_completed,
nullptr, // recv_version_negotiation nullptr, // recv_version_negotiation
ngtcp2_crypto_encrypt_cb, ngtcp2_crypto_encrypt_cb,