fix(notify): 根治低带宽控制面阻塞与传输写入卡死
- 为控制消息增加优先级、公平调度、队列字节预算和自适应批处理 - 支持可取消的写门等待,收紧 shared/dedicated bulk、stream 和 Reply 写入边界 - 修复 bulk reset/close、连接 handoff 和安全 profile 切换时序 - 保留旧取消与超时错误契约,新增阶段化 TransportSendError - 增加 ReplyCtx、ReplyObjCtx、写超时配置及黑洞连接和竞态回归测试
This commit is contained in:
+21
-2
@@ -221,6 +221,9 @@ func writeBulkDedicatedRecordWithDeadline(conn net.Conn, payload []byte, deadlin
|
||||
if conn == nil {
|
||||
return net.ErrClosed
|
||||
}
|
||||
if deadline.IsZero() {
|
||||
deadline = writeDeadlineFromTimeout(defaultBulkDataWriteTimeout)
|
||||
}
|
||||
return withRawConnWriteLockDeadline(conn, deadline, func(conn net.Conn) error {
|
||||
var header [bulkDedicatedRecordHeaderLen]byte
|
||||
copy(header[:4], bulkDedicatedRecordMagic)
|
||||
@@ -648,6 +651,9 @@ func (c *ClientCommon) sendDedicatedBulkAttachRequest(ctx context.Context, conn
|
||||
if bulk == nil {
|
||||
return bulkAttachResponse{}, errBulkIDEmpty
|
||||
}
|
||||
if ctx == nil {
|
||||
ctx = context.Background()
|
||||
}
|
||||
defer func() {
|
||||
_ = conn.SetReadDeadline(time.Time{})
|
||||
}()
|
||||
@@ -670,7 +676,16 @@ func (c *ClientCommon) sendDedicatedBulkAttachRequest(ctx context.Context, conn
|
||||
if err != nil {
|
||||
return bulkAttachResponse{}, err
|
||||
}
|
||||
if err := writeFullToConn(conn, frame); err != nil {
|
||||
if err := ctx.Err(); err != nil {
|
||||
return bulkAttachResponse{}, err
|
||||
}
|
||||
deadline := earlierWriteDeadline(
|
||||
writeDeadlineFromTimeout(c.maxWriteTimeoutSnapshot()),
|
||||
contextDeadline(ctx),
|
||||
)
|
||||
if err := withRawConnWriteLockDeadline(conn, deadline, func(conn net.Conn) error {
|
||||
return writeFullToConnUnlocked(conn, frame)
|
||||
}); err != nil {
|
||||
return bulkAttachResponse{}, err
|
||||
}
|
||||
if deadline, ok := ctx.Deadline(); ok {
|
||||
@@ -1019,7 +1034,11 @@ func (s *ServerCommon) replyDedicatedBulkAttachDetached(client *LogicalConn, con
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return withRawConnWriteLockDeadline(conn, writeDeadlineFromTimeout(client.maxWriteTimeoutSnapshot()), func(conn net.Conn) error {
|
||||
deadline := earlierWriteDeadline(
|
||||
writeDeadlineFromTimeout(defaultBulkDedicatedHelloTimeout),
|
||||
writeDeadlineFromTimeout(client.maxWriteTimeoutSnapshot()),
|
||||
)
|
||||
return withRawConnWriteLockDeadline(conn, deadline, func(conn net.Conn) error {
|
||||
return writeFullToConnUnlocked(conn, frame)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user