mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Make the deferred-request acknowledgement opt-in, and distinct
The acknowledgement added in "Reply to every debugger request" broke two cases
Nemoumbra pointed out, both of which come down to it reusing the request's own
event name.
A ticketless request is the bad one. {"event":"cpu.resume"} with no ticket drew
an immediate {"event":"cpu.resume"} - byte-identical to the broadcast that fires
when the game actually resumes. A client waiting for that broadcast concluded
the game was running while it was still stopped. Before, it correctly got
nothing until the resume really happened.
input.buttons.press is broken even with a ticket: it answers with the request's
own event name *and* ticket once the button has been held for the requested
frames, so the acknowledgement was indistinguishable from the real completion
and a client resolved on the first of the two. The claim in that commit that
the two are easy to tell apart was simply wrong for this handler.
So the acknowledgement is now off by default - the wire behaviour for every
existing client is exactly what it was - and a client that wants it asks, with
client.config.set {"acknowledgeDeferred": true}. It then arrives as its own
event rather than an echo:
-> {"event":"cpu.resume","ticket":7}
<- {"event":"deferred","for":"cpu.resume","ticket":7}
<- {"event":"cpu.resume"}
which is unambiguous in both cases above. That still gets the original goal -
correlating any request to a reply without hardcoding which events answer
immediately, including ones added later - just without imposing it on clients
that never asked.
Also documents the ticket convention this rests on: send one when you care
about the answer, leave it off to say you aren't waiting. wsdbg followed that
convention badly, silently inserting a ticket into a raw JSON line that
deliberately omitted one; it now sends raw lines exactly as written and simply
doesn't wait on those. It opts into acknowledgements at connect, so --sync
keeps working.
pspautotests 314/314, UnitTest 55/55.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GZq8ZtJmFY7bkX5FVkr3P9
This commit is contained in:
1 parent
8e2b53e9d0
commit
a8933099b7
9 files changed
+197
-51
No files matched your search
@@ -232,13 +232,13 @@ void HandleDebuggerRequest(const http::ServerRequest &request) {
|
||||
eventFunc->second(req);
|
||||
if (!req.Finish()) {
|
||||
// The handler arranged something that finishes later - a step, a resume, a stats
|
||||
// feed - rather than answering now. Acknowledge it anyway, so that *every* request
|
||||
// gets exactly one reply. Without this a client can't tell "accepted, wait for the
|
||||
// event" from "dropped on the floor", and any request/response correlation has to
|
||||
// special-case a list of events that don't answer. The event that actually reports
|
||||
// the result (cpu.stepping, and so on) still follows.
|
||||
req.Respond();
|
||||
req.Finish();
|
||||
// feed - rather than answering now. A client that asked for it gets told so, so it
|
||||
// can tell "accepted, wait for the event" from "dropped on the floor" without
|
||||
// carrying a hardcoded list of the events that don't answer. Everyone else sees
|
||||
// exactly what they saw before; see client.config.set for why it can't be the
|
||||
// default.
|
||||
if (client_info.acknowledgeDeferred)
|
||||
ws->Send(DebuggerDeferredEvent(event, root));
|
||||
// Poll more frequently for a second in case this triggers something.
|
||||
highActivity = 1000;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user