@mark1russell7/harness 0.12.3 → 0.12.4

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.
@@ -109,6 +109,9 @@ const open = async () => {
109
109
  channel = await connection.createConfirmChannel();
110
110
  } catch (error) {
111
111
  emit("channel", { event: "open-failed", at: node, failure: failure(error) });
112
+ // The next open replaces the connection, thus this one ends here and stays out of the next records.
113
+ connection.close().catch(() => undefined);
114
+ connection = null;
112
115
  return false;
113
116
  }
114
117
  channel.on("error", (error) => emit("channel", { event: "error", at: node, failure: failure(error) }));
@@ -39,6 +39,9 @@ def sniff(ifname):
39
39
  sport, dport, _seq, ack = struct.unpack("!HHII", tcp[:12])
40
40
  fl = tcp[13]
41
41
  with flock:
42
+ # A SYN starts a new flow: a 4-tuple that comes again has none of the state of its last flow.
43
+ if fl & 0x02:
44
+ flows.pop((src, sport, dst, dport), None)
42
45
  f = flows.setdefault((src, sport, dst, dport), {"ack": None, "closed": False})
43
46
  if fl & 0x10:
44
47
  f["ack"] = ack
@@ -85,8 +88,10 @@ def main():
85
88
  c, s, cp, sp, s2, r, sp2, rp = m.groups()
86
89
  cp, sp, sp2, rp = int(cp), int(sp), int(sp2), int(rp)
87
90
  k_cs, k_sr = (c, cp, s, sp), (s2, sp2, r, rp)
91
+ keys = (k_cs, (s, sp, c, cp), (r, rp, s2, sp2), k_sr)
88
92
  with flock:
89
- fs = {k: dict(flows[k]) for k in (k_cs, (s, sp, c, cp), (r, rp, s2, sp2), k_sr) if k in flows}
93
+ # Conntrack forgot the flow, thus the table forgets it too.
94
+ fs = {k: flows.pop(k) for k in keys if k in flows}
90
95
  if not fs or any(f["closed"] for f in fs.values()):
91
96
  continue
92
97
  seq_c = fs.get(k_cs, {}).get("ack") # the RCV.NXT of the client
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@mark1russell7/harness",
4
- "version": "0.12.3",
4
+ "version": "0.12.4",
5
5
  "description": "A fault-injection harness for connection timers: a cell runs a client against a stock target in Docker, through a topology of routers and proxies, a replicated group under Sentinels or a replica set, injects a fault, measures the kernel's own records and judges a prediction. HTTP clients of Go, Node and undici race the keep-alive of a Node server, and the MongoDB driver meets the faults of a replica set. The WebSocket client of @procedures/client drops a silent connection on its own heartbeat, and the harness times that detection and the reconnect from the program's lines and the kernel's stamps.",
6
6
  "keywords": [
7
7
  "fault-injection",