fix(notify): 根治低带宽控制面阻塞与传输写入卡死
- 为控制消息增加优先级、公平调度、队列字节预算和自适应批处理 - 支持可取消的写门等待,收紧 shared/dedicated bulk、stream 和 Reply 写入边界 - 修复 bulk reset/close、连接 handoff 和安全 profile 切换时序 - 保留旧取消与超时错误契约,新增阶段化 TransportSendError - 增加 ReplyCtx、ReplyObjCtx、写超时配置及黑洞连接和竞态回归测试
This commit is contained in:
+17
-12
@@ -9,14 +9,15 @@ import (
|
||||
)
|
||||
|
||||
type LogicalConn struct {
|
||||
client *ClientConn
|
||||
server Server
|
||||
ClientID string
|
||||
ClientAddr net.Addr
|
||||
state atomic.Pointer[logicalConnState]
|
||||
runtime atomic.Pointer[logicalConnRuntimeState]
|
||||
transportState atomic.Pointer[clientConnTransportState]
|
||||
attachment atomic.Pointer[clientConnAttachmentState]
|
||||
client *ClientConn
|
||||
server Server
|
||||
ClientID string
|
||||
ClientAddr net.Addr
|
||||
state atomic.Pointer[logicalConnState]
|
||||
runtime atomic.Pointer[logicalConnRuntimeState]
|
||||
transportState atomic.Pointer[clientConnTransportState]
|
||||
attachment atomic.Pointer[clientConnAttachmentState]
|
||||
inboundTransitionProfile atomic.Pointer[transportProtectionProfile]
|
||||
}
|
||||
|
||||
var errLogicalConnClientNil = errors.New("logical conn is nil")
|
||||
@@ -856,6 +857,10 @@ func (c *LogicalConn) sessionRuntimeSnapshot() *clientConnSessionRuntime {
|
||||
}
|
||||
|
||||
func (c *LogicalConn) setSessionRuntime(rt *clientConnSessionRuntime) {
|
||||
c.setSessionRuntimeWithCloseOld(rt, false)
|
||||
}
|
||||
|
||||
func (c *LogicalConn) setSessionRuntimeWithCloseOld(rt *clientConnSessionRuntime, closeOld bool) {
|
||||
if c == nil || rt == nil {
|
||||
return
|
||||
}
|
||||
@@ -883,7 +888,7 @@ func (c *LogicalConn) setSessionRuntime(rt *clientConnSessionRuntime) {
|
||||
client.syncLegacySessionRuntimeFromState(state)
|
||||
}
|
||||
if oldBinding != nil {
|
||||
oldBinding.stopBackgroundWorkers()
|
||||
stopReplacedTransportBinding(oldBinding, rt.transport, closeOld)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -982,14 +987,14 @@ func (c *LogicalConn) startSession(tuConn net.Conn, stopCtx context.Context, sto
|
||||
transportGeneration = c.markTransportAttached()
|
||||
c.clearTransportDetachState()
|
||||
}
|
||||
c.setSessionRuntime(&clientConnSessionRuntime{
|
||||
c.setSessionRuntimeWithCloseOld(&clientConnSessionRuntime{
|
||||
transport: newTransportBinding(tuConn, nil),
|
||||
transportAttached: tuConn != nil,
|
||||
transportGeneration: transportGeneration,
|
||||
tuConn: tuConn,
|
||||
stopCtx: stopCtx,
|
||||
stopFn: stopFn,
|
||||
})
|
||||
}, true)
|
||||
c.markSessionStarted()
|
||||
return stopCtx, stopFn
|
||||
}
|
||||
@@ -1030,7 +1035,7 @@ func (c *LogicalConn) attachSessionTransport(tuConn net.Conn) error {
|
||||
next.transportStopCtx = nil
|
||||
next.transportStopFn = nil
|
||||
next.transportDone = nil
|
||||
c.setSessionRuntime(&next)
|
||||
c.setSessionRuntimeWithCloseOld(&next, true)
|
||||
if tuConn.RemoteAddr() != nil {
|
||||
c.setRemoteAddr(tuConn.RemoteAddr())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user