Feature: transfer a Go-managed host to the MFC master from the web console
A Go-managed host cannot receive the client upgrade that only the MFC master can push. Transfer moves its main link there and brings it back after N days; MFC has no reason to return it. Transfer is not share: ASSIGN writes the target and drops the current connection, so the old master sees the host go offline and the new master gets a normal main link it can remote control and upgrade. While a transfer is live the client refuses a second transfer and any share, so no host is handed to a third master that expiry would orphan. Server: admin-only `transfer_device` WS command, COMMAND_ASSIGN_MASTER + SHARE_TYPE_YAMA_FOREVER as `host:port:days::transport\0`, byte-compatible with the MFC dialog. The transport segment is always present (YAMA_TRANSFER_TRANSPORT, default 0/TCP) because clients keep their current link when it is missing: a WSS-managed host would otherwise retry WSS against the MFC master's raw TCP port and never connect. The empty shine segment keeps the host's header encryption. The button only renders when `device_list.transfer` is present, which MFC never sends, so no MFC change is needed. devicehistory keeps transfer_to/transfer_until for the card badge and drops the marker on expiry or on a fresh login here. Client: KernelManager.cpp writes the registry and disconnects; ClientDll.cpp re-reads the registry at the top of every reconnect, so a mid-session transfer lands on the next round. Expiry is checked before every connect attempt as well as inside the heartbeat loop, so an unreachable target cannot pin the host to an expired address until a restart; restoring rebuilds the link captured on entry (address, header encryption, transport). linux/main.cpp applies the transfer on the main loop and restores the captured endpoint at expiry; Android does the same; macOS has neither share nor transfer.
This commit is contained in:
1 parent
b466f568ab
commit
63c7cdf588
18 files changed
+1024
-177
No files matched your search
+3
-4
@@ -142,12 +142,11 @@ public:
|
||||
// (主控经 nginx 走 WSS、分享目标直连设备端口时就得是 TCP),所以不能一律照抄主控。
|
||||
ClientApp* NewClientStartArg(const char* remoteAddr, IsRunning run = IsClientAppRunning, BOOL shared=FALSE, int headerEnc = -1, int protoType = -1);
|
||||
|
||||
// 分享实例的种类。取消分享只停 SHARED_KIND_SHARE;「转移主机」末尾贯穿到分享分支
|
||||
// 顺带起的那条连接标成 SHARED_KIND_TRANSFER,取消分享不能动它(与 Linux 客户端的
|
||||
// KIND_SHARE / KIND_TRANSFER 语义一致)。
|
||||
// 分享实例的种类。「转移主机」不再起分享实例(它直接让主连接搬到新主控),
|
||||
// 所以现在只有一种;保留枚举是为了让 StartSharedClient / StopSharedInstances
|
||||
// 的签名在后续再引入实例种类时不用改调用点。
|
||||
enum SharedInstanceKind {
|
||||
SHARED_KIND_SHARE = 1,
|
||||
SHARED_KIND_TRANSFER = 2,
|
||||
};
|
||||
|
||||
// 启动一个分享实例线程并在进程内登记,targetKey 为目标地址 "ip:port"。
|
||||
|
||||
Reference in new issue
Block a user