fix(notify): 根治低带宽控制面阻塞与传输写入卡死

- 为控制消息增加优先级、公平调度、队列字节预算和自适应批处理
- 支持可取消的写门等待,收紧 shared/dedicated bulk、stream 和 Reply 写入边界
- 修复 bulk reset/close、连接 handoff 和安全 profile 切换时序
- 保留旧取消与超时错误契约,新增阶段化 TransportSendError
- 增加 ReplyCtx、ReplyObjCtx、写超时配置及黑洞连接和竞态回归测试
This commit is contained in:
2026-08-14 10:16:37 +08:00
parent 98ef9e7fcc
commit 0826e17063
45 changed files with 4231 additions and 293 deletions
+22 -3
View File
@@ -1,6 +1,9 @@
package notify
import "context"
import (
"context"
"time"
)
func (s *ServerCommon) DebugMode(dmg bool) {
s.mu.Lock()
@@ -14,6 +17,20 @@ func (s *ServerCommon) IsDebugMode() bool {
return s.debugMode
}
func (s *ServerCommon) SetReplyWriteTimeout(timeout time.Duration) {
if s == nil {
return
}
s.replyWriteTimeout.Store(int64(maxDuration(0, timeout)))
}
func (s *ServerCommon) ReplyWriteTimeout() time.Duration {
if s == nil {
return 0
}
return time.Duration(s.replyWriteTimeout.Load())
}
func (s *ServerCommon) ShowError(std bool) {
s.mu.Lock()
s.showError = std
@@ -57,12 +74,14 @@ func (s *ServerCommon) SetDefaultCommDecode(fn func([]byte, []byte) []byte) {
}
func (s *ServerCommon) SetDefaultLink(fn func(message *Message)) {
s.linkMu.Lock()
defer s.linkMu.Unlock()
s.defaultFns = fn
}
func (s *ServerCommon) SetLink(key string, fn func(*Message)) {
s.mu.Lock()
defer s.mu.Unlock()
s.linkMu.Lock()
defer s.linkMu.Unlock()
s.linkFns[key] = fn
}