Skip to content

Commit

Permalink
Fix test: Data race while resetting global var. (#1748)
Browse files Browse the repository at this point in the history
  • Loading branch information
MakMukhi committed Dec 18, 2017
1 parent f4b5237 commit 6610f9a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions clientconn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,21 @@ func TestCloseConnectionWhenServerPrefaceNotReceived(t *testing.T) {
t.Fatalf("Error while dialing. Err: %v", err)
}
<-done
// TODO: The code from BEGIN to END should be delete once issue
// https://github.com/grpc/grpc-go/issues/1750 is fixed.
// BEGIN
// Set underlying addrConns state to Shutdown so that no reconnect
// attempts take place and thereby resetting minConnectTimeout is
// race free.
client.mu.Lock()
addrConns := client.conns
client.mu.Unlock()
for ac := range addrConns {
ac.mu.Lock()
ac.state = connectivity.Shutdown
ac.mu.Unlock()
}
// END
client.Close()
close(clientDone)
}
Expand Down

0 comments on commit 6610f9a

Please sign in to comment.