fix: close stream adaptive gaps and switch notify to stario v0.1.1
- make stream fast path honor adaptive soft payload limits end-to-end - split oversized fast-stream payloads into sequential frames before batching - use adaptive soft cap when encoding stream batch payloads - move timeout-like error detection into production code for adaptive tx - tune notify FrameReader read size explicitly to avoid throughput regression - drop local stario replace and depend on released b612.me/stario v0.1.1
This commit is contained in:
@@ -13,6 +13,7 @@ type clientConnAttachmentState struct {
|
||||
fastStreamEncode transportFastStreamEncoder
|
||||
fastBulkEncode transportFastBulkEncoder
|
||||
fastPlainEncode transportFastPlainEncoder
|
||||
modernPSKRuntime *modernPSKCodecRuntime
|
||||
handshakeRsaKey []byte
|
||||
secretKey []byte
|
||||
lastHeartBeat int64
|
||||
@@ -154,6 +155,7 @@ func (c *ClientConn) applyClientConnAttachmentProfile(maxReadTimeout time.Durati
|
||||
state.maxWriteTimeout = maxWriteTimeout
|
||||
state.msgEn = msgEn
|
||||
state.msgDe = msgDe
|
||||
state.modernPSKRuntime = nil
|
||||
state.handshakeRsaKey = cloneClientConnAttachmentBytes(handshakeRsaKey)
|
||||
state.secretKey = cloneClientConnAttachmentBytes(secretKey)
|
||||
})
|
||||
@@ -208,6 +210,7 @@ func (c *ClientConn) setClientConnMsgEn(fn func([]byte, []byte) []byte) {
|
||||
state.fastStreamEncode = nil
|
||||
state.fastBulkEncode = nil
|
||||
state.fastPlainEncode = nil
|
||||
state.modernPSKRuntime = nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -224,6 +227,7 @@ func (c *ClientConn) setClientConnMsgDe(fn func([]byte, []byte) []byte) {
|
||||
state.fastStreamEncode = nil
|
||||
state.fastBulkEncode = nil
|
||||
state.fastPlainEncode = nil
|
||||
state.modernPSKRuntime = nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -286,6 +290,64 @@ func (c *ClientConn) setClientConnSecretKey(key []byte) {
|
||||
})
|
||||
}
|
||||
|
||||
func (c *LogicalConn) attachmentStateRaw() *clientConnAttachmentState {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
if state := c.attachment.Load(); state != nil {
|
||||
if client := c.compatClientConn(); client != nil {
|
||||
client.attachment.Store(state)
|
||||
}
|
||||
return state
|
||||
}
|
||||
if client := c.compatClientConn(); client != nil {
|
||||
if state := client.attachment.Load(); state != nil {
|
||||
if c.attachment.CompareAndSwap(nil, state) {
|
||||
client.attachment.Store(state)
|
||||
return state
|
||||
}
|
||||
return c.attachmentStateRaw()
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *LogicalConn) modernPSKRuntimeSnapshot() *modernPSKCodecRuntime {
|
||||
if state := c.attachmentStateRaw(); state != nil {
|
||||
return state.modernPSKRuntime
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *LogicalConn) setModernPSKRuntime(runtime *modernPSKCodecRuntime) {
|
||||
c.updateAttachmentState(func(state *clientConnAttachmentState) {
|
||||
state.modernPSKRuntime = runtime
|
||||
})
|
||||
}
|
||||
|
||||
func (c *ClientConn) clientConnAttachmentStateRaw() *clientConnAttachmentState {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
if logical := c.logicalView.Load(); logical != nil {
|
||||
return logical.attachmentStateRaw()
|
||||
}
|
||||
return c.attachment.Load()
|
||||
}
|
||||
|
||||
func (c *ClientConn) clientConnModernPSKRuntimeSnapshot() *modernPSKCodecRuntime {
|
||||
if state := c.clientConnAttachmentStateRaw(); state != nil {
|
||||
return state.modernPSKRuntime
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *ClientConn) setClientConnModernPSKRuntime(runtime *modernPSKCodecRuntime) {
|
||||
c.updateClientConnAttachmentState(func(state *clientConnAttachmentState) {
|
||||
state.modernPSKRuntime = runtime
|
||||
})
|
||||
}
|
||||
|
||||
func (c *ClientConn) clientConnLastHeartbeatUnixSnapshot() int64 {
|
||||
if c == nil {
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user