Fix: keep zlib compression and host sharing mutually exclusive

The wire compression mode is a machine-wide setting (settings\compress),
so a zlib switch is inherited by share instances and by the
sub-connections they open later. A share peer that only speaks zstd
(the Go server has no zlib path) then loses the link on the next
connect. A shared instance could also rewrite the host's setting on
behalf of the sharing master.

The client now refuses COMMAND_SET_COMPRESS on a non-main instance,
refuses a switch to zlib while share_list is non-empty (zstd stays
allowed), and refuses a new share while the configured mode is zlib.
The share check reads settings\compress rather than the current
connection's m_useZlib: parallel-mode links can diverge from the
machine-wide value the new share instance will read. Refusals answer
with a ClientMsg so the operator sees why.

Verified: Debug x64 ghost and Release x64 ServerDll build with only the
pre-existing warnings; review flagged the live-flag divergence, fixed.

Co-Authored-By: deepseek-flash
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-11-27 12:23:22 +01:00
1 parent c9a18856e5
commit 1bd7fa5b2d
3 files changed
+40

No files matched your search

+7
View File
@@ -69,6 +69,13 @@ static bool ClientCompressUsesZlib()
#endif
}
// 对外暴露同一判定:分享前要确认新建的分享实例会用什么算法(它构造时读的就是
// 这个配置),不能用某条现有连接的 m_useZlib 代替。
bool IOCPClient::ConfiguredWireZlib()
{
return ClientCompressUsesZlib();
}
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////