Fix race in integration test.

This commit is contained in:
notsure2 2020-12-14 10:12:11 +02:00
parent 4dabcd22eb
commit 22148852dc
1 changed files with 4 additions and 0 deletions

View File

@ -185,7 +185,11 @@ func establishSession(lcc client.LocalConnConfig, rcc client.RemoteConnConfig, a
// whatever connection initiator (including a proper ck-client) // whatever connection initiator (including a proper ck-client)
netToCkServerD, ckServerListener := connutil.DialerListener(10 * 1024) netToCkServerD, ckServerListener := connutil.DialerListener(10 * 1024)
var sessionCreateMutex sync.Mutex
clientSeshMaker := func() *mux.Session { clientSeshMaker := func() *mux.Session {
sessionCreateMutex.Lock()
defer sessionCreateMutex.Unlock()
quad := make([]byte, 4) quad := make([]byte, 4)
common.RandRead(ai.WorldState.Rand, quad) common.RandRead(ai.WorldState.Rand, quad)
ai.SessionId = binary.BigEndian.Uint32(quad) ai.SessionId = binary.BigEndian.Uint32(quad)