(c *websocket.Conn)
| 537 | } |
| 538 | |
| 539 | func (tt *connTest) goDiscardLoop(c *websocket.Conn) { |
| 540 | ctx, cancel := context.WithCancel(tt.ctx) |
| 541 | |
| 542 | discardLoopErr := xsync.Go(func() error { |
| 543 | defer c.Close(websocket.StatusInternalError, "") |
| 544 | |
| 545 | for { |
| 546 | _, _, err := c.Read(ctx) |
| 547 | if err != nil { |
| 548 | return assertCloseStatus(websocket.StatusNormalClosure, err) |
| 549 | } |
| 550 | } |
| 551 | }) |
| 552 | tt.t.Cleanup(func() { |
| 553 | cancel() |
| 554 | err := <-discardLoopErr |
| 555 | if err != nil { |
| 556 | tt.t.Errorf("discard loop error: %v", err) |
| 557 | } |
| 558 | }) |
| 559 | } |
| 560 | |
| 561 | func BenchmarkConn(b *testing.B) { |
| 562 | benchCases := []struct { |
no test coverage detected