Commit Graph
5 Commits
Author SHA1 Message Date
yuanyuanxiangandClaude Code d9fe93ff1e Fix(client): stop Windows share connections immediately on cancel
「取消分享」原来只清 share_list。Windows 的分享实例是同进程里的一个 ClientApp
线程,没有引用可停,连接会一直保持到客户端进程重启;Linux 的分享实例是独立
子进程,取消时直接 stop,两端行为不一致。

- 新增进程内分享实例登记表:起线程前登记 ClientApp 指针、种类与目标 ip:port,
  线程退出时(先摘除后 delete)注销;取消分享时在锁内逐个置 S_CLIENT_EXIT,
  心跳/重连循环约 1 秒内退出并关闭连接。登记项带 stopping 标记,正在退出的
  实例不再被视为可用连接。
- 区分 SHARED_KIND_SHARE / SHARED_KIND_TRANSFER:转移命令末尾贯穿到分享分支
  顺带起的连接标为 TRANSFER,取消分享不动它(取消分享撤销不了转移)。
- 同一目标只保留一条连接:重新分享(换 Shine/传输方式)先停旧实例并等待注销,
  再起新连接;启动时按 ip:port 去重历史 share_list,收到分享命令时也顺手归并
  旧记录;转移目标已有分享实例时不再多连一条(与 Linux SpawnManagedChild 一致)。
- 转移临时连接按 valid_to 自查到期(外层重连循环与内层心跳循环都查),主实例
  到期恢复分支也会停掉它,不再一直挂到进程重启。
- StartClientApp 只在状态不是 S_CLIENT_EXIT 时复位:取消请求可能在登记后、
  线程开跑前落地;SERVER_EXIT/UPDATE 仍照常复位,主控重启后分享实例照旧重连。
  分享实例退出不再置进程级 g_IsAppExit(否则会误伤 FRP 等模块),也不再做
  服务端退出专用的额外等待。
- 转移命令加 IsMainInstance 门禁;Linux 侧只更新注释。

验证:Debug 客户端构建通过;两个自动化 E2E(Debug 服务端 + 假 TCP 目标):
取消分享后连接 1 秒内关闭且主连接仍在线;同目标换 Shine 重新分享时旧连接关闭、
新连接建立,随后取消同样生效。

Model: deepseek-flash
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-19 19:05:04 +01:00
yuanyuanxiang 454d25d37f fix(share): carry the transport in the share and assign payloads
The share payload was host:port:shine and carried no transport at all, so a
shared client fell back to its baked-in protoType. Share instances also skip
ApplyProtoSwitch (ClientDll.cpp:810), so a client upgraded to WSS was shared
to a TLS front end as raw TCP and looped on HTTP/1.1 400.

Extend both payloads with an optional trailing transport field:

    share  : host:port:shine[:transport]
    assign : host:port:days:shine[:transport]

The field is omitted when the source protocol is not TCP/WS/WSS, so HTTP/UDP/
KCP hosts keep their previous behaviour instead of being silently downgraded
to plain TCP.

- server: add SelectedShareTransport(), share it between OnOnlineShare and
  OnOnlineAssignTo, and accept a tcp:// ws:// wss:// prefix in the address.
- client: parse the field on both paths and persist the assigned value to
  settings/master_transport, clearing it when the field is absent.
- share_list: dedup on host:port instead of the whole record, so re-sharing
  a host with a different transport replaces the stale entry.
- assign: guard bToken[_MAX_PATH] against the longer payload.
- lang: translate the reworded prompt and the three new messages in en_US,
  zh_TW and de_DE.

Transport is pinned at share time and does not follow a later protocol switch
on the master link; the m_bShared gate stays as-is on purpose.
2026-11-02 14:01:39 +01:00
yuanyuanxiang 99db28e2e2 Feature: Let the operator switch a live client's transport from the online list 2026-10-30 17:22:36 +01:00
yuanyuanxianganddeepseek-v4-pro e9d60e6e23 Feature: Add Shine/HELL protocol selection to share/transfer host
Add a dedicated ShareHostDlg with a "Use Shine protocol" checkbox (default
checked) so the operator can choose Shine (0) or HELL (1) when sharing or
transferring a host. The chosen protocol is appended to the wire payload as a
trailing colon field: "IP:PORT:0/1" for share and "IP:PORT:days:0/1" for
transfer.

The client parses the trailing field from COMMAND_SHARE and
COMMAND_ASSIGN_MASTER, applies it to new connections, and persists it so
auto-share/auto-transfer on restart keeps the same protocol. Old clients
ignore the extra field, and old/missing payloads fall back to -1 (baked-in
HELL), preserving compatibility with existing servers and share_list entries.

Co-Authored-By: deepseek-v4-pro
2026-09-11 16:28:37 +02:00
yuanyuanxiang 5a325a202b Init: Migrate SimpleRemoter (Since v1.3.1) to Gitea 2026-04-19 22:55:21 +02:00