Add IPC backoff/retries and safer disposal

Introduce exponential backoff, jitter and retry logic across IPC components to improve robustness and avoid tight retry loops; make disposal idempotent and add connection guards. Key changes:
- LauncherCoordinatorIpcServer / LauncherIpcServer: add backoff constants, ComputeBackoff(), consecutive error tracking and delayed retries with jitter.
- LanMountainDesktopIpcClient / LauncherIpcClient: add connect retry loops, timeouts, delayed retries, improved error logging, and use ArrayPool for buffered async writes; ensure proper cleanup on failures.
- PublicIpcHostService: add disposed flag, guard OnPeerConnected and Dispose, and clear connected peers on dispose.
- Add many auto-generated commit analysis docs under docs/auto_commit_md and new scripts for analyzing/generating commit docs.
These changes aim to make IPC connection handling more resilient and resource-safe.
This commit is contained in:
lincube
2026-05-07 21:39:21 +08:00
parent 84caca02bf
commit d8f75e86be
159 changed files with 8809 additions and 31 deletions

View File

@@ -0,0 +1,80 @@
# Commit 深度分析报告
**提交哈希**: `0085c66514214501f23b97a8f9af55c3fc853cdc`
**提交时间**: 2025-05-22 09:20:57
**作者**: lincube <lincube3@hotmail.com>
**重要性**: FEATURE
## 提交消息
```
Introduce HostLaunchPlan and refine launch flow
```
## 变更统计
- **新增文件**: 8
- **修改文件**: 12
- **删除文件**: 3
### 文件类型分布
- `.cs`: 18 个文件
- `.axaml`: 2 个文件
## 变更文件列表
| 文件路径 | 变更类型 |
|---------|---------|
| `LanMountainDesktop/Services/Launch/` | 新增 |
| `LanMountainDesktop/Models/LaunchPlan.cs` | 新增 |
| `LanMountainDesktop/ViewModels/Launch/` | 修改 |
## 影响分析
- 受影响的模块: LanMountainDesktop, Services, ViewModels
- 涉及 18 个 C# 文件变更
- 涉及 UI/XAML 文件变更
- 这是一个功能新增提交,扩展了项目能力
## 代码审查要点
- ⚠️ 关键文件变更: Service - 需要特别关注
- ⚠️ 启动流程变更可能影响应用初始化
## 详细分析
### 1. HostLaunchPlan 架构
本次提交引入了 HostLaunchPlan宿主启动计划概念这是一个重要的架构改进
- **启动计划定义**: 明确定义了应用启动的各个阶段
- **依赖管理**: 支持服务之间的依赖关系管理
- **异步启动**: 优化了异步启动流程
### 2. 启动流程优化
- 分离了宿主初始化和服务启动
- 引入了启动阶段的概念
- 改进了错误处理和恢复机制
### 3. 技术实现要点
```csharp
// 伪代码示例
public class HostLaunchPlan
{
public List<LaunchPhase> Phases { get; set; }
public Dictionary<string, IService> Services { get; set; }
public async Task ExecuteAsync()
{
foreach (var phase in Phases)
{
await phase.ExecuteAsync();
}
}
}
```
### 4. 潜在风险
- 启动顺序变更可能引入竞态条件
- 需要确保所有服务正确注册
- 启动失败时的回滚机制
## 建议
1. 添加启动时间监控
2. 完善启动失败的重试机制
3. 考虑添加启动阶段的可视化
4. 编写启动流程文档