control-channel: userActive is the SendAwakeBeat test, not a time window

QA finding 3. `tick` computed `userActive` as "input within the last
heartbeat interval". `SendAwakeBeat` instead sends `Awake` when
`lastRealInputEventCount != Event.RealInputEventCount` — real input since
the previous heartbeat — and re-records the counter every time it runs
(Common.cs:545-558). Keep the same two counters: `noteUserActivity()` is
`Event.RealInputEventCount++` (InputHook.cs:223, 345) and the channel
re-records on its own heartbeat boundary, which is the one global beat
Windows's 100 ms timer runs for every socket (frmScreen.cs:565-575).

Also fixes the stale citation for this rule in docs/protocol.md §3.3,
which pointed at SendHeartBeat/screen-capture code (Common.cs:499-513,
662-676) instead of SendAwakeBeat.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
lucioandClaude Opus 5 committed 2026-09-16 01:41:41 -07:00
1 parent c9ea89ac50
commit a892af6ca3
3 files changed
+33 -8

No files matched your search

+5 -1
View File
@@ -89,7 +89,11 @@ No packet is interpreted here.
budget expired is actually dialled.
- **Ticks**: the channel runs one 100 ms `DispatchSourceTimer` that
calls `Session.tick(now:userActive:)` on every connection (the app
reports `userActive` via `noteUserActivity()`), drains outboxes and
reports input via `noteUserActivity()`, which is our
`Event.RealInputEventCount++`, `InputHook.cs:223, 345`; `userActive` is
then "the counter moved since the previous heartbeat", the test
`SendAwakeBeat` makes and re-records every time it runs,
`Common.cs:545-558` — not a sliding window around `now`), drains outboxes and
events, and detects the C2 "30 s silence while we are sending input"
stall: if the connection the sink marked as `controlled` receives
nothing for 30 s while packets are being forwarded to it, close it.