@amritk/nish-aarch64-linux 0.34.1 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -436,29 +436,57 @@ export class QuicRecovery {
436
436
  for (const sp of this.spaces) {
437
437
  sp.reset()
438
438
  }
439
+ this.resetPath()
440
+ this.maxAckDelay = QUIC_RECOVERY_DEFAULT_MAX_ACK_DELAY
441
+ this.micros = -1
442
+ this.ptoCount = 0
443
+ this.timeoutSpace = -1
444
+ this.congestionEvents = 0
445
+ this.persistentCongestions = 0
446
+ this.ecnCongestionEvents = 0
447
+ this.restartEcn()
448
+ this.handshakeConfirmed = false
449
+ }
450
+
451
+ /**
452
+ * Starts the RTT estimate, the congestion window and the pacer again from
453
+ * their initial values, for a connection whose peer moved to a new
454
+ * address it has proved it holds (RFC 9000 §9.4): what was learnt of the
455
+ * old path says nothing about the new one. The packets in flight, the
456
+ * peer's `max_ack_delay` and the counters are kept.
457
+ */
458
+ resetPath(): void {
439
459
  this.latestRtt = 0
440
460
  this.smoothedRtt = QUIC_RECOVERY_INITIAL_RTT
441
461
  this.rttVar = QUIC_RECOVERY_INITIAL_RTT / 2
442
462
  this.minRtt = 0
443
463
  this.firstSampleTime = -1
444
- this.maxAckDelay = QUIC_RECOVERY_DEFAULT_MAX_ACK_DELAY
445
464
  this.congestionWindow = QUIC_RECOVERY_INITIAL_WINDOW
446
465
  this.ssthresh = QUIC_MAX_VARINT
447
466
  this.recoveryStart = -1
448
467
  this.pacerBudget = QUIC_RECOVERY_INITIAL_WINDOW
449
468
  this.pacerTime = -1
450
469
  this.pacerRtt = QUIC_RECOVERY_INITIAL_RTT * QUIC_RECOVERY_MICROS
451
- this.micros = -1
452
- this.ptoCount = 0
453
- this.timeoutSpace = -1
454
- this.congestionEvents = 0
455
- this.persistentCongestions = 0
456
- this.ecnCongestionEvents = 0
470
+ }
471
+
472
+ /**
473
+ * Tests ECN again from the start, as on a new path (RFC 9000 §13.4.2).
474
+ * Every packet still in flight loses its mark: those sent on the old
475
+ * path, and those sent to the new one before it was validated, which
476
+ * went out under the old test. Their loss, or an ACK of them, says
477
+ * nothing of the new test, and only packets marked from here on count
478
+ * toward it.
479
+ */
480
+ restartEcn(): void {
481
+ for (const sp of this.spaces) {
482
+ for (let s: i32 = 0; s < toI32(sp.state.length); s += 1) {
483
+ sp.setMarked(s, false)
484
+ }
485
+ }
457
486
  this.ecnState = QUIC_RECOVERY_ECN_TESTING
458
487
  this.ecnTestSent = 0
459
488
  this.ecnTestRecorded = 0
460
489
  this.ecnTestLost = 0
461
- this.handshakeConfirmed = false
462
490
  }
463
491
 
464
492
  /** Space `space`'s packets, or `null` for an index that names no space. */