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
68 lines
2.1 KiB
C
68 lines
2.1 KiB
C
// stdafx.h : include file for standard system include files,
|
|
// or project specific include files that are used frequently, but
|
|
// are changed infrequently
|
|
//
|
|
|
|
#if !defined(AFX_STDAFX_H__46CA6496_AAD6_4658_B6E9_D7AEB26CDCD5__INCLUDED_)
|
|
#define AFX_STDAFX_H__46CA6496_AAD6_4658_B6E9_D7AEB26CDCD5__INCLUDED_
|
|
|
|
// 客户端线缆压缩:Windows 客户端同时编译 zlib 与 zstd,运行期由 settings\compress
|
|
// 选择(默认 zstd;配置为 zlib 时使用 zlib)。服务端可通过 COMMAND_SET_COMPRESS
|
|
// 写入该配置并触发重连,见 client/IOCPClient.cpp 与 KernelManager 的处理分支。
|
|
#define USING_ZSTD 1
|
|
#define USING_CTX 1
|
|
|
|
// 是否使用 Opus 音频压缩 (需要 opus 库)
|
|
// 设为 1 启用 Opus 压缩,设为 0 使用 PCM 无压缩
|
|
#define USING_OPUS 1
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif // _MSC_VER > 1000
|
|
|
|
#ifdef _DEBUG
|
|
// 检测内存泄漏,需安装VLD;否则请注释此行
|
|
#include "vld.h"
|
|
#ifndef VLD_RPTHOOK_REMOVE
|
|
#error 检测内存泄漏,需安装VLD;否则请注释#include "vld.h",或使用Release编译
|
|
#endif
|
|
#define USING_SAFETHRED 0
|
|
#define IsDebug 1
|
|
#else
|
|
#define USING_SAFETHRED 1
|
|
#define IsDebug 0
|
|
#endif
|
|
|
|
// Insert your headers here
|
|
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
|
|
|
#include <windows.h>
|
|
|
|
// TODO: reference additional headers your program requires here
|
|
|
|
//{{AFX_INSERT_LOCATION}}
|
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
|
|
|
#endif // !defined(AFX_STDAFX_H__46CA6496_AAD6_4658_B6E9_D7AEB26CDCD5__INCLUDED_)
|
|
|
|
#include <assert.h>
|
|
#include <MMSystem.h>
|
|
#pragma comment(lib, "winmm.lib")
|
|
|
|
#ifndef SAFE_DELETE
|
|
#define SAFE_DELETE(p) if(NULL !=(p)){ delete (p);(p) = NULL;}
|
|
#endif
|
|
|
|
#ifndef SAFE_DELETE_ARRAY
|
|
#define SAFE_DELETE_ARRAY(p) if(NULL !=(p)){ delete[] (p);(p) = NULL;}
|
|
#endif
|
|
|
|
#ifndef SAFE_DELETE_AR
|
|
#define SAFE_DELETE_AR(p) if(NULL !=(p)){ delete[] (p);(p) = NULL;}
|
|
#endif
|
|
|
|
#define SAFE_CLOSE_HANDLE(h) do{if((h)!=NULL&&(h)!=INVALID_HANDLE_VALUE){CloseHandle(h);(h)=NULL;}}while(0)
|
|
|
|
#include "common/logger.h"
|
|
#include "common/locker.h"
|