Feature: update zlib to 1.4 and pick wire compression at runtime
The client selected zlib or zstd for the wire protocol at compile time (USING_ZLIB), so changing the mode required a rebuild, and the vendored zlib was still 1.3.2. Vendored zlib is now 1.4 (headers and both static libs rebuilt from the upstream source root). The client links zlib and zstd together and reads settings\compress from its own registry key when a connection is created: "zlib" selects zlib, anything else keeps the zstd default. Every connection reads it once, so sub-connections follow the main link. The online list context menu gains "Experimental -> Wire compression: ZSTD / ZLIB". It sends COMMAND_SET_COMPRESS (181) only to hosts that declare CLIENT_CAP_COMPRESS_SWITCH; the client persists the choice and restarts its connection thread, so the new mode applies in about two seconds without restarting the process. The online-info tooltip now marks the negotiated algorithm with [ZSTD] / [ZLIB] / [NONE]. Also fixes zlib buffer sizing on both ends: 1.001n+12 is one byte short of compressBound for packets under about 1 KB, which silently dropped small commands. Verified: both modes connect and receive MasterSettings; menu switching to zlib and back reconnects in each mode; Debug/Release x64, Release x86, ServerDll and server builds pass. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
340fb20518
commit
0e20e0bbdb
20 files changed
+303
-84
No files matched your search
@@ -41,6 +41,7 @@ public:
|
||||
virtual std::string GetProtocol() const = 0;
|
||||
virtual int GetServerPort() const = 0;
|
||||
virtual FlagType GetFlagType() const = 0;
|
||||
virtual int GetCompressMethod() const = 0; // COMPRESS_ZSTD / COMPRESS_ZLIB / COMPRESS_NONE
|
||||
virtual std::string GetGroupName() const = 0;
|
||||
virtual uint64_t GetAliveTime()const = 0;
|
||||
virtual void SetLastHeartbeat(uint64_t time) = 0;
|
||||
@@ -199,6 +200,14 @@ public:
|
||||
return (strtoul(caps.GetString(), nullptr, 16) & CLIENT_CAP_PROTO_SWITCH) != 0;
|
||||
}
|
||||
|
||||
// 检查客户端是否支持远程切换线缆压缩(COMMAND_SET_COMPRESS,zstd / zlib)。
|
||||
// 只有声明 CLIENT_CAP_COMPRESS_SWITCH 的 Windows 客户端认识。
|
||||
bool SupportsCompressSwitch() const {
|
||||
CString caps = GetClientData(ONLINELIST_CAPABILITIES);
|
||||
if (caps.IsEmpty()) return false;
|
||||
return (strtoul(caps.GetString(), nullptr, 16) & CLIENT_CAP_COMPRESS_SWITCH) != 0;
|
||||
}
|
||||
|
||||
// 检查客户端是否支持收到 COMMAND_UPDATE 下发的 APK 后拉起系统安装器。
|
||||
// 只有新版 Android 客户端声明;老 APK 收到命令会走 default 静默丢弃,
|
||||
// 服务端据此提示「先手动装一次新版」。
|
||||
|
||||
Reference in new issue
Block a user