Preserve Web machine reset protocol continuity

This commit is contained in:
2026-08-28 22:54:51 +08:00
parent cbd0bc1003
commit a97971ea19
7 changed files with 53 additions and 35 deletions

View File

@@ -77,7 +77,14 @@ int32_t sim_protocol_accept(uint32_t schema_version, uint32_t seq,
else if (is_kind(kind, "PROGRAM_PAUSE")) state.state = SIM_PROTOCOL_PAUSED;
else if (is_kind(kind, "PROGRAM_RESUME") || is_kind(kind, "RESUME")) state.state = SIM_PROTOCOL_READY;
else if (is_kind(kind, "DESTROY")) state.state = SIM_PROTOCOL_DESTROYED;
else if (is_kind(kind, "RESET")) sim_protocol_reset();
else if (is_kind(kind, "RESET")) {
/* RESET is a machine/task reset once attached. Keep the transport
sequence alive so a Web client can continue issuing commands. A
RESET received after DESTROY remains the protocol reinitialization
edge used by the session lifecycle. */
if (state.state == SIM_PROTOCOL_DESTROYED) sim_protocol_reset();
else state.state = SIM_PROTOCOL_READY;
}
return SIM_PROTOCOL_OK;
}