@@ -1422,7 +1422,7 @@ bool QuicApplication::SendPendingData() {
14221422 continue ;
14231423 case NGTCP2_ERR_STREAM_NOT_FOUND:
14241424 continue ;
1425- case NGTCP2_ERR_WRITE_STREAM_MORE :
1425+ case NGTCP2_ERR_WRITE_MORE :
14261426 CHECK_GT (ndatalen, 0 );
14271427 CHECK (StreamCommit (&stream_data, ndatalen));
14281428 pos += ndatalen;
@@ -2096,7 +2096,6 @@ bool QuicSession::Receive(
20962096
20972097 if (!is_destroyed ())
20982098 UpdateIdleTimer ();
2099-
21002099 SendPendingData ();
21012100 Debug (this , " Successfully processed received packet" );
21022101 return true ;
@@ -2239,8 +2238,11 @@ void QuicSession::RemoveStream(int64_t stream_id) {
22392238void QuicSession::ScheduleRetransmit () {
22402239 uint64_t now = uv_hrtime ();
22412240 uint64_t expiry = ngtcp2_conn_get_expiry (connection ());
2242- uint64_t interval = (expiry - now) / 1000000UL ;
2243- if (expiry < now || interval == 0 ) interval = 1 ;
2241+ // now and expiry are in nanoseconds, interval is milliseconds
2242+ uint64_t interval = (expiry < now) ? 1 : (expiry - now) / 1000000UL ;
2243+ // If interval ends up being 0, the repeating timer won't be
2244+ // scheduled, so set it to 1 instead.
2245+ if (interval == 0 ) interval = 1 ;
22442246 Debug (this , " Scheduling the retransmit timer for %" PRIu64, interval);
22452247 UpdateRetransmitTimer (interval);
22462248}
@@ -2440,7 +2442,7 @@ bool QuicSession::SendPacket(std::unique_ptr<QuicPacket> packet) {
24402442
24412443 IncrementStat (&QuicSessionStats::bytes_sent, packet->length ());
24422444 RecordTimestamp (&QuicSessionStats::sent_at);
2443- ScheduleRetransmit ();
2445+ // ScheduleRetransmit();
24442446
24452447 Debug (this , " Sending %" PRIu64 " bytes to %s from %s" ,
24462448 packet->length (),
@@ -2471,6 +2473,7 @@ void QuicSession::SendPendingData() {
24712473 Debug (this , " Error sending QUIC application data" );
24722474 HandleError ();
24732475 }
2476+ ScheduleRetransmit ();
24742477}
24752478
24762479// When completing the TLS handshake, the TLS session information
@@ -3392,11 +3395,9 @@ int QuicSession::OnStreamReset(
33923395// Currently, there is only one use. In the future, we'll want to
33933396// explore whether we want to handle the different cases uses.
33943397int QuicSession::OnRand (
3395- ngtcp2_conn* conn,
33963398 uint8_t * dest,
33973399 size_t destlen,
3398- ngtcp2_rand_ctx ctx,
3399- void * user_data) {
3400+ ngtcp2_rand_ctx ctx) {
34003401 EntropySource (dest, destlen);
34013402 return 0 ;
34023403}
@@ -3541,6 +3542,8 @@ const ngtcp2_conn_callbacks QuicSession::callbacks[2] = {
35413542 OnConnectionIDStatus,
35423543 OnHandshakeConfirmed,
35433544 nullptr , // recv_new_token
3545+ ngtcp2_crypto_delete_crypto_aead_ctx_cb,
3546+ ngtcp2_crypto_delete_crypto_cipher_ctx_cb,
35443547 },
35453548 // NGTCP2_CRYPTO_SIDE_SERVER
35463549 {
@@ -3574,6 +3577,8 @@ const ngtcp2_conn_callbacks QuicSession::callbacks[2] = {
35743577 OnConnectionIDStatus,
35753578 nullptr , // handshake_confirmed
35763579 nullptr , // recv_new_token
3580+ ngtcp2_crypto_delete_crypto_aead_ctx_cb,
3581+ ngtcp2_crypto_delete_crypto_cipher_ctx_cb,
35773582 }
35783583};
35793584
@@ -3585,7 +3590,11 @@ BaseObjectPtr<QLogStream> QuicSession::qlog_stream() {
35853590 return qlog_stream_;
35863591}
35873592
3588- void QuicSession::OnQlogWrite (void * user_data, const void * data, size_t len) {
3593+ void QuicSession::OnQlogWrite (
3594+ void * user_data,
3595+ uint32_t flags,
3596+ const void * data,
3597+ size_t len) {
35893598 QuicSession* session = static_cast <QuicSession*>(user_data);
35903599 Environment* env = session->env ();
35913600
@@ -3888,7 +3897,6 @@ void NewQuicClientSession(const FunctionCallbackInfo<Value>& args) {
38883897 args[ARG_IDX::QLOG]->IsTrue () ?
38893898 QlogMode::kEnabled :
38903899 QlogMode::kDisabled );
3891-
38923900 session->SendPendingData ();
38933901 if (session->is_destroyed ())
38943902 return args.GetReturnValue ().Set (ERR_FAILED_TO_CREATE_SESSION);
0 commit comments