Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit d6b2afd

Browse files
authored
fix: Test race when accessing session (#355)
1 parent bf7f71a commit d6b2afd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

wsnet/wsnet_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ func createDumbBroker(t *testing.T) (connectAddr string, listenAddr string) {
5858
t.Error(err)
5959
return
6060
}
61+
nc := websocket.NetConn(context.Background(), c, websocket.MessageBinary)
62+
mut.Lock()
63+
defer mut.Unlock()
6164
if sess == nil {
6265
t.Error("listen not called")
6366
return
6467
}
65-
nc := websocket.NetConn(context.Background(), c, websocket.MessageBinary)
66-
mut.Lock()
67-
defer mut.Unlock()
6868
oc, err := sess.Open()
6969
if err != nil {
7070
t.Error(err)

0 commit comments

Comments
 (0)