Browse Source

fix dispatcher test

Darien Raymond 7 years ago
parent
commit
255090c5c0
1 changed files with 5 additions and 3 deletions
  1. 5 3
      transport/internet/udp/dispatcher_test.go

+ 5 - 3
transport/internet/udp/dispatcher_test.go

@@ -59,13 +59,15 @@ func TestSameDestinationDispatching(t *testing.T) {
 
 	b := buf.New()
 	b.AppendBytes('a', 'b', 'c', 'd')
-	dispatcher := NewDispatcher(td)
+
 	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)
 	})
+
+	dispatcher.Dispatch(ctx, dest, b)
 	for i := 0; i < 5; i++ {
-		dispatcher.Dispatch(ctx, dest, b, func(payload *buf.Buffer) {})
+		dispatcher.Dispatch(ctx, dest, b)
 	}
 
 	time.Sleep(time.Second)