record-daemon: fix gamephase event handling

This commit is contained in:
vhaudiquet committed 2026-03-19 22:05:13 +01:00
1 parent 7e346a33e0
commit dbb224e118
4 files changed
+37

No files matched your search

+10
View File
@@ -178,6 +178,8 @@ impl DaemonStateMachine {
// From Recording
(DaemonState::Recording, StateTransition::GameEnded) => Some(DaemonState::Monitoring),
// Allow GameStarted from Recording (handles case where GameEnded wasn't received)
(DaemonState::Recording, StateTransition::GameStarted { .. }) => Some(DaemonState::Recording),
(DaemonState::Recording, StateTransition::ClientStopped) => Some(DaemonState::Idle),
(DaemonState::Recording, StateTransition::Error(_)) => Some(DaemonState::Error),
(DaemonState::Recording, StateTransition::Shutdown) => Some(DaemonState::ShuttingDown),
@@ -212,6 +214,14 @@ impl DaemonStateMachine {
champion: info.champion.clone(),
}),
GameEvent::GameEnd(_) => Some(StateTransition::GameEnded),
GameEvent::PhaseChange(info) => {
// When phase changes to None while recording, the player left the game
if info.phase == "None" && self.is_recording() {
Some(StateTransition::GameEnded)
} else {
None
}
}
_ => None,
}
}