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,55 @@
|
||||
package notify
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestClientStreamConfigPublicAPI(t *testing.T) {
|
||||
client := NewClient().(*ClientCommon)
|
||||
|
||||
client.SetStreamConfig(StreamConfig{
|
||||
ChunkSize: 1024,
|
||||
InboundQueueLimit: 16,
|
||||
InboundBufferedBytesLimit: 32 * 1024,
|
||||
OutboundWindowBytes: 128 * 1024,
|
||||
OutboundMaxInFlightChunks: 4,
|
||||
})
|
||||
|
||||
cfg := client.GetStreamConfig()
|
||||
if got, want := cfg.ChunkSize, 1024; got != want {
|
||||
t.Fatalf("chunk size = %d, want %d", got, want)
|
||||
}
|
||||
if got, want := cfg.InboundQueueLimit, 16; got != want {
|
||||
t.Fatalf("queue limit = %d, want %d", got, want)
|
||||
}
|
||||
if got, want := cfg.InboundBufferedBytesLimit, 32*1024; got != want {
|
||||
t.Fatalf("buffered limit = %d, want %d", got, want)
|
||||
}
|
||||
if got, want := cfg.OutboundWindowBytes, 128*1024; got != want {
|
||||
t.Fatalf("outbound window = %d, want %d", got, want)
|
||||
}
|
||||
if got, want := cfg.OutboundMaxInFlightChunks, 4; got != want {
|
||||
t.Fatalf("outbound max inflight chunks = %d, want %d", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestServerStreamConfigPublicAPINormalizesDefaults(t *testing.T) {
|
||||
server := NewServer().(*ServerCommon)
|
||||
|
||||
server.SetStreamConfig(StreamConfig{})
|
||||
cfg := server.GetStreamConfig()
|
||||
|
||||
if got, want := cfg.ChunkSize, defaultFileChunkSize; got != want {
|
||||
t.Fatalf("chunk size = %d, want %d", got, want)
|
||||
}
|
||||
if got, want := cfg.InboundQueueLimit, defaultStreamInboundQueueLimit; got != want {
|
||||
t.Fatalf("queue limit = %d, want %d", got, want)
|
||||
}
|
||||
if got, want := cfg.InboundBufferedBytesLimit, defaultStreamInboundBufferedBytesLimit; got != want {
|
||||
t.Fatalf("buffered limit = %d, want %d", got, want)
|
||||
}
|
||||
if got, want := cfg.OutboundWindowBytes, defaultStreamOutboundWindowBytes; got != want {
|
||||
t.Fatalf("outbound window = %d, want %d", got, want)
|
||||
}
|
||||
if got, want := cfg.OutboundMaxInFlightChunks, defaultStreamOutboundMaxInFlightChunks; got != want {
|
||||
t.Fatalf("outbound max inflight chunks = %d, want %d", got, want)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user