fix(notify): 根治低带宽控制面阻塞与传输写入卡死
- 为控制消息增加优先级、公平调度、队列字节预算和自适应批处理 - 支持可取消的写门等待,收紧 shared/dedicated bulk、stream 和 Reply 写入边界 - 修复 bulk reset/close、连接 handoff 和安全 profile 切换时序 - 保留旧取消与超时错误契约,新增阶段化 TransportSendError - 增加 ReplyCtx、ReplyObjCtx、写超时配置及黑洞连接和竞态回归测试
This commit is contained in:
+28
-9
@@ -10,8 +10,9 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
systemPeerAttachKey = "_notify_peer_attach"
|
||||
peerAttachTimeout = 5 * time.Second
|
||||
systemPeerAttachKey = "_notify_peer_attach"
|
||||
peerAttachTimeout = 5 * time.Second
|
||||
peerAttachTransitionFallbackTTL = peerAttachTimeout
|
||||
)
|
||||
|
||||
type peerAttachRequest struct {
|
||||
@@ -206,11 +207,17 @@ func (s *ServerCommon) replyPeerAttach(client *LogicalConn, message Message, res
|
||||
Value: encoded,
|
||||
Type: MSG_SYS_REPLY,
|
||||
}
|
||||
transport := messageTransportConnSnapshot(&message)
|
||||
profile := messageInboundTransportProtectionSnapshot(&message)
|
||||
if message.inboundConn != nil {
|
||||
return s.sendTransferInbound(client, messageTransportConnSnapshot(&message), message.inboundConn, messageInboundTransportProtectionSnapshot(&message), reply)
|
||||
return s.sendTransferInbound(client, transport, message.inboundConn, profile, reply)
|
||||
}
|
||||
_, err = s.sendLogical(client, reply)
|
||||
return err
|
||||
env, err := wrapTransferMsgEnvelope(reply, s.sequenceEn)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
env.transportProfile = profile
|
||||
return s.sendSignalEnvelopeMaybeReliableTransport(transport, env, reply)
|
||||
}
|
||||
|
||||
func (s *ServerCommon) handlePeerAttachSystemMessage(message Message) bool {
|
||||
@@ -219,6 +226,10 @@ func (s *ServerCommon) handlePeerAttachSystemMessage(message Message) bool {
|
||||
}
|
||||
message = hydrateServerMessagePeerFields(message)
|
||||
current := messageLogicalConnSnapshot(&message)
|
||||
if message.inboundTransportProfile == nil && current != nil {
|
||||
profile := current.transportProtectionProfileSnapshot()
|
||||
message.inboundTransportProfile = &profile
|
||||
}
|
||||
transport := message.inboundConn
|
||||
if transport == nil && current != nil {
|
||||
transport = current.transportSnapshot()
|
||||
@@ -281,12 +292,20 @@ func (s *ServerCommon) handlePeerAttachSystemMessage(message Message) bool {
|
||||
s.peerAttachAuthFallbackCount.Add(1)
|
||||
}
|
||||
}
|
||||
if err := s.replyPeerAttach(bound, message, resp); err != nil && bound != nil {
|
||||
s.stopLogicalSession(bound, "peer attach reply failed", err)
|
||||
return true
|
||||
}
|
||||
var transitionProfile *transportProtectionProfile
|
||||
if bound != nil && s.securityConfigured {
|
||||
if message.inboundTransportProfile != nil {
|
||||
transitionProfile = bound.installInboundTransitionProfile(*message.inboundTransportProfile)
|
||||
}
|
||||
bound.applyTransportProtectionProfile(steadyProfile)
|
||||
}
|
||||
replyErr := s.replyPeerAttach(bound, message, resp)
|
||||
if transitionProfile != nil {
|
||||
bound.clearInboundTransitionProfile(transitionProfile)
|
||||
}
|
||||
if replyErr != nil && bound != nil {
|
||||
s.stopLogicalSession(bound, "peer attach reply failed", replyErr)
|
||||
return true
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user