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

Method goEchoLoop

conn_test.go:523–537  ·  view source on GitHub ↗
(c *websocket.Conn)

Source from the content-addressed store, hash-verified

521}
522
523func (tt *connTest) goEchoLoop(c *websocket.Conn) {
524 ctx, cancel := context.WithCancel(tt.ctx)
525
526 echoLoopErr := xsync.Go(func() error {
527 err := wstest.EchoLoop(ctx, c)
528 return assertCloseStatus(websocket.StatusNormalClosure, err)
529 })
530 tt.t.Cleanup(func() {
531 cancel()
532 err := <-echoLoopErr
533 if err != nil {
534 tt.t.Errorf("echo loop error: %v", err)
535 }
536 })
537}
538
539func (tt *connTest) goDiscardLoop(c *websocket.Conn) {
540 ctx, cancel := context.WithCancel(tt.ctx)

Callers 2

TestConnFunction · 0.80
BenchmarkConnFunction · 0.80

Calls 3

GoFunction · 0.92
EchoLoopFunction · 0.92
assertCloseStatusFunction · 0.70

Tested by

no test coverage detected