Eliminate race on ac.acbw (#1666)

Guard ac.acbw with mutex
This commit is contained in:
Menghan Li 2017-11-13 13:43:31 -08:00 committed by GitHub
parent 5f2e2f999e
commit 87bcb38fba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -246,7 +246,9 @@ func (acbw *acBalancerWrapper) UpdateAddresses(addrs []resolver.Address) {
return
}
acbw.ac = ac
ac.mu.Lock()
ac.acbw = acbw
ac.mu.Unlock()
if acState != connectivity.Idle {
ac.connect()
}