服务器重启后的逻辑处理

This commit is contained in:
zqm
2026-04-10 15:34:09 +08:00
parent 075844bd3c
commit 6b2724adcc

View File

@@ -1476,14 +1476,14 @@ async fn run_updater(debug_mode: bool) -> bool {
data_str
);
// 收到 welcome 后,根据当前阶段发送 GetFileVer
// 收到 welcome 后,重置状态并从头开始执行流程
if msg_type == "welcome" {
if !device_number.is_empty() && device_number != "UNKNOWN" {
let current_phase = *ctx_clone.current_phase.lock().unwrap();
// 重连后强制从头开始
*ctx_clone.current_phase.lock().unwrap() = UpdatePhase::BootLoader;
let ts = chrono::Local::now().format("%Y-%m-%d %H:%M:%S%.3f");
log_print!("{} [重连] 重置状态,从头开始执行流程", ts);
match current_phase {
UpdatePhase::BootLoader => {
if !device_number.is_empty() && device_number != "UNKNOWN" {
// 阶段1只请求 BootLoader.exe
log_print!("{} [阶段1] 检查 BootLoader...", ts);
let msg_str = format!(
@@ -1493,11 +1493,6 @@ async fn run_updater(debug_mode: bool) -> bool {
log_print!("{} 发送消息:{}", ts, msg_str);
sender.send(msg_str);
}
_ => {
// 其他阶段由 FileVer 响应后推进,不在这里处理
}
}
}
}
// 处理 FileVer 响应(根据当前阶段分发)