@@ -1422,7 +1422,7 @@ bool QuicApplication::SendPendingData() {
1422
1422
continue ;
1423
1423
case NGTCP2_ERR_STREAM_NOT_FOUND:
1424
1424
continue ;
1425
- case NGTCP2_ERR_WRITE_STREAM_MORE :
1425
+ case NGTCP2_ERR_WRITE_MORE :
1426
1426
CHECK_GT (ndatalen, 0 );
1427
1427
CHECK (StreamCommit (&stream_data, ndatalen));
1428
1428
pos += ndatalen;
@@ -2096,7 +2096,6 @@ bool QuicSession::Receive(
2096
2096
2097
2097
if (!is_destroyed ())
2098
2098
UpdateIdleTimer ();
2099
-
2100
2099
SendPendingData ();
2101
2100
Debug (this , " Successfully processed received packet" );
2102
2101
return true ;
@@ -2239,8 +2238,11 @@ void QuicSession::RemoveStream(int64_t stream_id) {
2239
2238
void QuicSession::ScheduleRetransmit () {
2240
2239
uint64_t now = uv_hrtime ();
2241
2240
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 ;
2244
2246
Debug (this , " Scheduling the retransmit timer for %" PRIu64, interval);
2245
2247
UpdateRetransmitTimer (interval);
2246
2248
}
@@ -2440,7 +2442,7 @@ bool QuicSession::SendPacket(std::unique_ptr<QuicPacket> packet) {
2440
2442
2441
2443
IncrementStat (&QuicSessionStats::bytes_sent, packet->length ());
2442
2444
RecordTimestamp (&QuicSessionStats::sent_at);
2443
- ScheduleRetransmit ();
2445
+ // ScheduleRetransmit();
2444
2446
2445
2447
Debug (this , " Sending %" PRIu64 " bytes to %s from %s" ,
2446
2448
packet->length (),
@@ -2471,6 +2473,7 @@ void QuicSession::SendPendingData() {
2471
2473
Debug (this , " Error sending QUIC application data" );
2472
2474
HandleError ();
2473
2475
}
2476
+ ScheduleRetransmit ();
2474
2477
}
2475
2478
2476
2479
// When completing the TLS handshake, the TLS session information
@@ -3392,11 +3395,9 @@ int QuicSession::OnStreamReset(
3392
3395
// Currently, there is only one use. In the future, we'll want to
3393
3396
// explore whether we want to handle the different cases uses.
3394
3397
int QuicSession::OnRand (
3395
- ngtcp2_conn* conn,
3396
3398
uint8_t * dest,
3397
3399
size_t destlen,
3398
- ngtcp2_rand_ctx ctx,
3399
- void * user_data) {
3400
+ ngtcp2_rand_ctx ctx) {
3400
3401
EntropySource (dest, destlen);
3401
3402
return 0 ;
3402
3403
}
@@ -3541,6 +3542,8 @@ const ngtcp2_conn_callbacks QuicSession::callbacks[2] = {
3541
3542
OnConnectionIDStatus,
3542
3543
OnHandshakeConfirmed,
3543
3544
nullptr , // recv_new_token
3545
+ ngtcp2_crypto_delete_crypto_aead_ctx_cb,
3546
+ ngtcp2_crypto_delete_crypto_cipher_ctx_cb,
3544
3547
},
3545
3548
// NGTCP2_CRYPTO_SIDE_SERVER
3546
3549
{
@@ -3574,6 +3577,8 @@ const ngtcp2_conn_callbacks QuicSession::callbacks[2] = {
3574
3577
OnConnectionIDStatus,
3575
3578
nullptr , // handshake_confirmed
3576
3579
nullptr , // recv_new_token
3580
+ ngtcp2_crypto_delete_crypto_aead_ctx_cb,
3581
+ ngtcp2_crypto_delete_crypto_cipher_ctx_cb,
3577
3582
}
3578
3583
};
3579
3584
@@ -3585,7 +3590,11 @@ BaseObjectPtr<QLogStream> QuicSession::qlog_stream() {
3585
3590
return qlog_stream_;
3586
3591
}
3587
3592
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) {
3589
3598
QuicSession* session = static_cast <QuicSession*>(user_data);
3590
3599
Environment* env = session->env ();
3591
3600
@@ -3888,7 +3897,6 @@ void NewQuicClientSession(const FunctionCallbackInfo<Value>& args) {
3888
3897
args[ARG_IDX::QLOG]->IsTrue () ?
3889
3898
QlogMode::kEnabled :
3890
3899
QlogMode::kDisabled );
3891
-
3892
3900
session->SendPendingData ();
3893
3901
if (session->is_destroyed ())
3894
3902
return args.GetReturnValue ().Set (ERR_FAILED_TO_CREATE_SESSION);
0 commit comments