control-channel: detect a machine-id collision on client sockets only
QA finding 2. The id check ran for every connection that finished its handshake, so an inbound peer announcing our own id could force-close every socket and make the app draw a new machine id. Windows runs the id comparison and the keep-the-first-client rule as two branches of one block gated by `status == Connected && tcp.IsClient` (SocketStuff.cs:1980-1981): a server-accepted socket reaches neither. Move the collision check inside the `isOutbound` gate the dedup half already had, and say so in the README and docs/protocol.md §10.3 note 3. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
1 parent
43dc25ac71
commit
c9ea89ac50
3 files changed
+35
-17
No files matched your search
@@ -66,10 +66,14 @@ No packet is interpreted here.
|
||||
and one inbound connection per peer, and forwards every app packet to
|
||||
both — the receiver's replay ring collapses the pair (contracts C1).
|
||||
- **Machine-id collision** (`SocketStuff.cs:1984-1992`): if a trusted
|
||||
peer reports our own id, the channel reports `.idCollision` to the
|
||||
sink; the app regenerates and calls `reopenAll()`. Windows force-closes
|
||||
*every* socket in that branch, not just the offending one
|
||||
(`docs/protocol.md` §10.3 note 3), and so do we.
|
||||
peer reports our own id **over an outbound connection**, the channel
|
||||
reports `.idCollision` to the sink; the app regenerates and calls
|
||||
`reopenAll()`. Windows force-closes *every* socket in that branch, not
|
||||
just the offending one (`docs/protocol.md` §10.3 note 3), and so do we.
|
||||
Like the duplicate-client rule, this is client-only: `UpdateTcpSockets`
|
||||
runs the whole block under `status == Connected && tcp.IsClient`
|
||||
(`:1980-1981`), so an id reported over an inbound connection is
|
||||
silently tolerated, here as there.
|
||||
- **Failure budget per endpoint** (`SocketStuff.cs:1482-1499`): more
|
||||
than 10 `.invalidKey` outcomes from the same remote address ⇒ report
|
||||
`.peerRejected(address)` and stop dialling it until `reopenAll()`.
|
||||
|
||||
Reference in new issue
Block a user