Fix: Stop the client dropping chat messages that begin with e
CChatManager::OnReceive opened with the same heartbeat guard the other managers use, `if (szBuffer[0] == TOKEN_HEARTBEAT) return;`, before it looked at the length. TOKEN_HEARTBEAT is 101, which is also the letter e, and this channel carries free text rather than command bytes, so every message starting with e -- "echo", "error", anything -- was silently discarded. The sender never learned: the server's chat dialog had already written the text into its own log, so the two sides disagreed about what was said. The guard is dead code here. Heartbeats travel on the main connection only, as a multi-byte [101][Heartbeat] packet consumed by the main dispatcher; the server never sends one on a chat sub-connection. Delete it and keep the length check that follows. The server keeps prepending a space when the GBK payload starts with 101, because already-deployed clients still carry the guard and losing the message outright is worse than an invisible leading space. Note the same guard, harmless today, still sits in the machine, file, proxy and screen-hide managers. Verified with the Debug instance and a local Debug client: with the server's space temporarily disabled, chat_send "echo test" and "second line" both showed up verbatim in the client dialog (read back with WM_GETTEXT); with the space restored the first arrives as " echo test". Details in docs/Mcp_Chat_Design.md section 5. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
cc3e11d30d
commit
1c5fab1645
3 files changed
+24
-10
No files matched your search
@@ -465,7 +465,11 @@ INT_PTR CALLBACK CChatManager::ChatDialogProc(HWND hDlg, UINT uMsg, WPARAM wPara
|
||||
|
||||
VOID CChatManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
{
|
||||
if (szBuffer[0] == TOKEN_HEARTBEAT) return;
|
||||
// 这里没有心跳包:心跳只走主连接([TOKEN_HEARTBEAT][Heartbeat],且由主连接分发消费),
|
||||
// 服务端从不给交谈子连接发心跳。原先照搬其它 manager 的
|
||||
// if (szBuffer[0] == TOKEN_HEARTBEAT) return;
|
||||
// 会在任何长度判断之前丢掉首字节为 101('e') 的包——而本通道承载的是自由文本,
|
||||
// 于是「echo」「error」这类以 e 开头的消息被静默吞掉。删掉即可,保留长度判断。
|
||||
|
||||
if (ulLength == 1) {
|
||||
switch (szBuffer[0]) {
|
||||
|
||||
Reference in new issue
Block a user