Files
notify/client_dispatcher.go
T
b612 0826e17063 fix(notify): 根治低带宽控制面阻塞与传输写入卡死
- 为控制消息增加优先级、公平调度、队列字节预算和自适应批处理
- 支持可取消的写门等待,收紧 shared/dedicated bulk、stream 和 Reply 写入边界
- 修复 bulk reset/close、连接 handoff 和安全 profile 切换时序
- 保留旧取消与超时错误契约,新增阶段化 TransportSendError
- 增加 ReplyCtx、ReplyObjCtx、写超时配置及黑洞连接和竞态回归测试
2026-08-14 10:16:37 +08:00

51 lines
1008 B
Go

package notify
func (c *ClientCommon) dispatchMsg(message Message) {
switch message.TransferMsg.Type {
case MSG_SYS_WAIT:
fallthrough
case MSG_SYS:
c.sysMsg(message)
return
case MSG_KEY_CHANGE:
fallthrough
case MSG_SYS_REPLY:
fallthrough
case MSG_SYNC_REPLY:
if c.getPendingWaitPool().deliver(message.ID, message) {
return
}
fallthrough
default:
}
if c.dispatchInternalTransferControl(message) {
return
}
callFn := func(fn func(*Message)) {
fn(&message)
}
c.linkMu.RLock()
fn, ok := c.linkFns[message.Key]
defaultFn := c.defaultFns
c.linkMu.RUnlock()
if ok && fn != nil {
callFn(fn)
}
if defaultFn != nil {
callFn(defaultFn)
}
}
func (c *ClientCommon) sysMsg(message Message) {
switch message.Key {
case "bye":
if message.TransferMsg.Type == MSG_SYS_WAIT {
c.setByeFromServer(true)
message.Reply(nil)
c.stopClientSession("recv stop signal from server", nil)
return
}
c.stopClientSessionFromServer("recv stop signal from server", nil)
}
}