feat(core): TCP timing and closing after Java, measured with Java FILIUS

TCP follows Java's TCPSocket where it differs from Swift: each attempt and
TIME_WAIT wait three round trips that follow the speed (8250 ms at 90 %),
counted from when the segment is handed down, before ARP; the next segment
ends TIME_WAIT; the other end closes by itself on FIN; data no one
acknowledges closes with FIN; the accepted socket has the listener's
initial sequence number, and the listener takes the next.

Not taken from Java: three SYNs, not one (Java's retry loop ends after
the first timeout), named in tcpJava.test.ts as JAVA_BUGS.

tcpJava.test.ts compares TcpRun's three stories frame by frame and state
by state; the Swift comparison only checks that the TCP scenarios differ.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-30 11:17:44 +00:00
co-authored by Claude Opus 5.5
parent cd3c6a432c
commit cec0a92f95
8 changed files with 488 additions and 129 deletions
+5 -1
View File
@@ -285,7 +285,8 @@ const SWIFT_ERRORS: Record<string, (expected: Record<string, unknown>) => Record
/**
* Scenarios where the engine follows Java instead of Swift; the Java
* comparison checks them (dhcpJava.test.ts, measured with Java FILIUS). Here
* comparisons check that behaviour (dhcpJava.test.ts, tcpJava.test.ts,
* measured with Java FILIUS). Here
* they must differ from Swift, or the departure is not real.
*/
const JAVA_INSTEAD_OF_SWIFT: Record<string, string> = {
@@ -293,6 +294,9 @@ const JAVA_INSTEAD_OF_SWIFT: Record<string, string> = {
'dhcp-two-servers': 'DHCP client: the second OFFER is read and dropped, no REQUEST twice (Swift: answered with NAK)',
'dhcp-conflict': 'DHCP client: the ARP check finds the address taken and declines (Swift: it does not wait, two cards share the address)',
'dhcp-no-server': 'DHCP client: a link-local address after five timeouts (Swift: the old address after ten)',
'tcp-lan': 'TCP: the other end closes by itself on FIN, TIME_WAIT lasts 3 round trips, the accepted socket has the listener\'s sequence number',
'tcp-routed-loss': 'TCP: 3 round trips per attempt follow the speed (8250 ms at 90 %), failed data closes with FIN',
'tcp-closing': 'TCP: TIME_WAIT lasts 3 round trips and ends with the next segment; the other end closes by itself',
};
describe('same result as the Swift engine', () => {