perf: accept thread + dial backoff; join/peers.json (0.9.23)

Run inbound peer handling on its own thread so outbound dials cannot starve
:9100. Failed peers cool down exponentially. Also land --join (member seat)
and realm/peers.json seed discovery for Tailscale meshes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
WHC
2026-10-29 18:16:46 +08:00
co-authored by Cursor
parent de2eaf87f7
commit c329db504d
7 changed files with 273 additions and 37 deletions
+12 -2
View File
@@ -17,15 +17,24 @@ cst-agent --realm-password-init
```bash
export CST_INSTANCE_ID=laptop-a # 可选;默认用本机 hostname
cst-agent --login --realm-label "thinkpad"
# 其他机器(同 salt/公钥 + 密码):
cst-agent --join --instance phone-b --realm-label "pixel"
# TUI: /realm login(夺主席)或 /realm join(不抢主席)
```
跨网段(如 Tailscale)多播发现不可用时,在 Realm 目录放 `peers.json`:
```json
{"peers":[{"host":"100.64.0.13","port":9100,"iid":"labpc","name":"labpc"}]}
```
效果:
1. 用密码解锁 Realm;`--login` / `/realm login` 使本机成为**唯一主席**
2. `/realm join` 只登记席位票:主席空缺时才夺椅,否则以 **member** 身份加入
2. `--join` / `/realm join` 只登记席位票:主席空缺时才夺椅,否则以 **member** 身份加入
3. 写入本地登录票(24h;成员票在主席易主后仍有效,除非本席被剥夺主席)
4. 拉起后台议会服务(发现 + 密封通道按 revision 同步 `parliament.context`)
4. 拉起后台议会服务(发现 + 密封通道按 revision 同步 `parliament.context`;
Unix 下 accept 独立线程,dial 失败会指数退避,避免饿死入站)
查看状态:
@@ -94,6 +103,7 @@ Alpine 内构建,chair↔member 握手 + 密封通道同步(`sealed=1` / `pe
|------|------|
| `--realm-password-init` | 创建密码 Realm |
| `--login` | 登录 + 夺主席 + 启服务 |
| `--join` | 加入席位(不抢主席)+ 启服务 |
| `--service` / `--service-fg` | 仅启服务 |
| `--service-stop` | 停服务 |
| `--new-project ID` | 清场换项目 |