File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -553,3 +553,26 @@ func assertClose(tb testing.TB, c *websocket.Conn) {
553
553
err := c .Close (websocket .StatusNormalClosure , "" )
554
554
assert .Success (tb , err )
555
555
}
556
+
557
+ func TestConcurrentClosePing (t * testing.T ) {
558
+ t .Parallel ()
559
+ for i := 0 ; i < 64 ; i ++ {
560
+ func () {
561
+ c1 , c2 := wstest .Pipe (nil , nil )
562
+ defer c1 .CloseNow ()
563
+ defer c2 .CloseNow ()
564
+ c1 .CloseRead (context .Background ())
565
+ c2 .CloseRead (context .Background ())
566
+ go func () {
567
+ for range time .Tick (time .Millisecond ) {
568
+ if err := c1 .Ping (context .Background ()); err != nil {
569
+ return
570
+ }
571
+ }
572
+ }()
573
+
574
+ time .Sleep (10 * time .Millisecond )
575
+ assert .Success (t , c1 .Close (websocket .StatusNormalClosure , "" ))
576
+ }()
577
+ }
578
+ }
You can’t perform that action at this time.
0 commit comments