mirror of https://github.com/v2ray/v2ray-core
fix dispatcher test
parent
2b0196527d
commit
255090c5c0
|
@ -59,13 +59,15 @@ func TestSameDestinationDispatching(t *testing.T) {
|
||||||
|
|
||||||
b := buf.New()
|
b := buf.New()
|
||||||
b.AppendBytes('a', 'b', 'c', 'd')
|
b.AppendBytes('a', 'b', 'c', 'd')
|
||||||
dispatcher := NewDispatcher(td)
|
|
||||||
var msgCount uint32
|
var msgCount uint32
|
||||||
dispatcher.Dispatch(ctx, dest, b, func(payload *buf.Buffer) {
|
dispatcher := NewDispatcher(td, func(ctx context.Context, payload *buf.Buffer) {
|
||||||
atomic.AddUint32(&msgCount, 1)
|
atomic.AddUint32(&msgCount, 1)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
dispatcher.Dispatch(ctx, dest, b)
|
||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
dispatcher.Dispatch(ctx, dest, b, func(payload *buf.Buffer) {})
|
dispatcher.Dispatch(ctx, dest, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
time.Sleep(time.Second)
|
time.Sleep(time.Second)
|
||||||
|
|
Loading…
Reference in New Issue