MCPcopy
hub / github.com/coder/websocket / TestConcurrentClosePing

Function TestConcurrentClosePing

conn_test.go:710–734  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

708}
709
710func TestConcurrentClosePing(t *testing.T) {
711 t.Parallel()
712 for range 64 {
713 func() {
714 c1, c2 := wstest.Pipe(nil, nil)
715 defer c1.CloseNow()
716 defer c2.CloseNow()
717 c1.CloseRead(context.Background())
718 c2.CloseRead(context.Background())
719 errc := xsync.Go(func() error {
720 for range time.Tick(time.Millisecond) {
721 err := c1.Ping(context.Background())
722 if err != nil {
723 return err
724 }
725 }
726 panic("unreachable")
727 })
728
729 time.Sleep(10 * time.Millisecond)
730 assert.Success(t, c1.Close(websocket.StatusNormalClosure, ""))
731 <-errc
732 }()
733 }
734}
735
736func TestConnClosePropagation(t *testing.T) {
737 t.Parallel()

Callers

nothing calls this directly

Calls 7

PipeFunction · 0.92
GoFunction · 0.92
SuccessFunction · 0.92
CloseNowMethod · 0.45
CloseReadMethod · 0.45
PingMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…