Fix: keep the in-process test client alive on compression switch

Switching wire compression used to set g_bExit = S_CLIENT_UPDATE and
disconnect. Standalone clients restart fine, but the in-process test
client (ServerDll loaded with MemoryModule) only restarts AutoRun on
S_SERVER_EXIT; S_CLIENT_UPDATE made TestRun return and AutoRun exit, so
the host went offline for good and the "Run Test Program" menu stayed
disabled.

The command handler now disconnects and calls
IOCPClient::SetWireCompression() on the existing connection object.
The reconnect loop reuses it with the new mode; sub-connections are
rebuilt from the saved config after the main link reconnects. g_bExit
is no longer touched.

The experimental menu gains two 16x16 icons (blue Z for zstd, orange L
for zlib) and grays the algorithm the selected hosts already use
(all-zstd grays ZSTD, all-zlib grays ZLIB, mixed leaves both enabled,
unsupported clients gray both). The new strings are translated in the
en_US, de_DE and zh_TW packs (the German pack also gained the missing
"Experimental" group title).

Verified: with an isolated Debug server, the in-process test client
switches zstd -> zlib -> zstd, reconnects in about 3 s each time and
keeps receiving MasterSettings; the menu reports the expected gray
state and icons in a captured screenshot.

Co-Authored-By: deepseek-flash
This commit was merged in pull request #9.
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-11-24 10:33:42 +01:00
1 parent 0e20e0bbdb
commit e6a3255a2b
13 files changed
+74 -17

No files matched your search

+3 -2
View File
@@ -387,8 +387,9 @@ enum {
TOKEN_MCP_WINDOW_INFO = 180,
// 线缆压缩切换(服务端 → 客户端):载荷 [cmd:1]["zlib"|"zstd"]。
// 客户端写入自己配置的 settings\compress 后重启 StartClient 线程,新连接按新模式
// 重连;服务端按首包自动识别算法,无需额外握手。只有声明 CLIENT_CAP_COMPRESS_SWITCH
// 客户端写入自己配置的 settings\compress 后断开当前连接,原地切换本连接的压缩模式,
// 由 StartClient 重连循环用新模式建链;服务端按首包自动识别算法,无需额外握手。
// 不置 S_CLIENT_UPDATE,以免进程内测试客户端退出。只有声明 CLIENT_CAP_COMPRESS_SWITCH
// 的 Windows 客户端认识;老客户端走 default 静默丢弃。
COMMAND_SET_COMPRESS = 181,