nish 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.
- package/README.md +7 -6
- package/docs/AI.md +77 -14
- package/docs/INSTALL.md +16 -12
- package/llms.txt +5 -2
- package/package.json +5 -5
- package/runtime/async.d.mts +49 -0
- package/runtime/async.mjs +27 -0
- package/runtime/nish.d.ts +72 -0
- package/runtime/nish.h +6 -2
- package/runtime/nish.mjs +4 -0
- package/runtime/runtime-net.c +22 -0
- package/runtime/runtime-shm.c +93 -2
- package/std/README.md +131 -131
- package/std/bytes.ts +2 -2
- package/std/net/http1-codec.ts +67 -55
- package/std/net/http1-server.ts +87 -9
- package/std/net/http3-server.ts +30 -6
- package/std/net/postgres.ts +79 -10
- package/std/net/quic-recovery.ts +36 -8
- package/std/net/quic.ts +664 -59
- package/std/sync/ring.ts +236 -16
- package/std/sync/shm.ts +29 -0
package/std/net/quic-recovery.ts
CHANGED
|
@@ -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
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
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. */
|