fix: 停机排空计入正在发送的帧并为断开预留时间
This commit is contained in:
@@ -274,6 +274,27 @@ func TestShutdownCancelledContextReturnsQuickly(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestWaitConnsQuietSeesInSend(t *testing.T) {
|
||||
b, err := New(Options{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer func() { _ = b.Close() }()
|
||||
st := &connState{downCh: make(chan downItem, 1)}
|
||||
st.inSend.Store(1)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 40*time.Millisecond)
|
||||
defer cancel()
|
||||
if b.waitConnsQuiet(ctx, []*connState{st}) {
|
||||
t.Fatal("inSend should keep shutdown from treating the conn as quiet")
|
||||
}
|
||||
st.inSend.Store(0)
|
||||
ctx2, cancel2 := context.WithTimeout(context.Background(), 200*time.Millisecond)
|
||||
defer cancel2()
|
||||
if !b.waitConnsQuiet(ctx2, []*connState{st}) {
|
||||
t.Fatal("quiet when inSend is 0 and queues are empty")
|
||||
}
|
||||
}
|
||||
|
||||
func TestEffectivePayloadLimitSubtractsOverhead(t *testing.T) {
|
||||
got := EffectivePayloadLimit(200, 0)
|
||||
if got != 200-packetOverheadBudget {
|
||||
|
||||
Reference in New Issue
Block a user