mirror of
https://github.com/mjl-/mox.git
synced 2025-07-10 07:54:40 +03:00
fix race in test setup/teardown
not easily triggered, but it happened just now on a build server.
This commit is contained in:
@ -346,11 +346,9 @@ func startArgs(t *testing.T, first, isTLS, allowLoginWithoutTLS bool) *testconn
|
||||
err = acc.SetPassword("testtest")
|
||||
tcheck(t, err, "set password")
|
||||
}
|
||||
var switchDone chan struct{}
|
||||
switchStop := func() {}
|
||||
if first {
|
||||
switchDone = store.Switchboard()
|
||||
} else {
|
||||
switchDone = make(chan struct{}) // Dummy, that can be closed.
|
||||
switchStop = store.Switchboard()
|
||||
}
|
||||
|
||||
serverConn, clientConn := net.Pipe()
|
||||
@ -368,7 +366,7 @@ func startArgs(t *testing.T, first, isTLS, allowLoginWithoutTLS bool) *testconn
|
||||
cid := connCounter
|
||||
go func() {
|
||||
serve("test", cid, tlsConfig, serverConn, isTLS, allowLoginWithoutTLS)
|
||||
close(switchDone)
|
||||
switchStop()
|
||||
close(done)
|
||||
}()
|
||||
client, err := imapclient.New(clientConn, true)
|
||||
|
Reference in New Issue
Block a user