feat(notify): 重构通信内核并补齐 stream/bulk/record/transfer 能力
- 引入 LogicalConn/TransportConn 分层,ClientConn 保留兼容适配层 - 新增 Stream、Bulk、RecordStream 三条数据面能力及对应控制路径 - 完成 transfer/file 传输内核与状态快照、诊断能力 - 补齐 reconnect、inbound dispatcher、modern psk 等基础模块 - 增加大规模回归、并发与基准测试覆盖 - 更新依赖库
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package notify
|
||||
|
||||
import "errors"
|
||||
|
||||
var (
|
||||
errServiceShutdown = errors.New("service shutdown")
|
||||
errTransportDetached = errors.New("transport detached")
|
||||
)
|
||||
|
||||
func (c *ClientCommon) ensureClientSendReady() error {
|
||||
if !sessionIsAlive(&c.alive) {
|
||||
return errServiceShutdown
|
||||
}
|
||||
if !c.clientTransportAttachedSnapshot() {
|
||||
return clientTransportDetachedError(c)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *ServerCommon) ensureServerSendReady(client *ClientConn) error {
|
||||
if client == nil {
|
||||
return s.ensureServerTransportSendReady(nil)
|
||||
}
|
||||
return s.ensureServerTransportSendReady(s.resolveOutboundTransport(logicalConnFromClient(client)))
|
||||
}
|
||||
|
||||
func (s *ServerCommon) ensureServerTransportSendReady(transport *TransportConn) error {
|
||||
if !sessionIsAlive(&s.alive) {
|
||||
return errServiceShutdown
|
||||
}
|
||||
if s.serverUDPListenerSnapshot() != nil {
|
||||
if transport == nil || transport.RemoteAddr() == nil || !transport.IsCurrent() {
|
||||
return transportDetachedErrorForTransport(transport)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if transport == nil || !transport.Attached() || !transport.HasRuntimeConn() || !transport.IsCurrent() {
|
||||
return transportDetachedErrorForTransport(transport)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user