mirror of https://github.com/grpc/grpc-go.git
fix deadlock of roundrobin balancer (#1353)
This commit is contained in:
parent
8264d619d8
commit
27b2052c95
|
|
@ -201,6 +201,10 @@ func (rr *roundRobin) watchAddrUpdates() error {
|
|||
if rr.done {
|
||||
return ErrClientConnClosing
|
||||
}
|
||||
select {
|
||||
case <-rr.addrCh:
|
||||
default:
|
||||
}
|
||||
rr.addrCh <- open
|
||||
return nil
|
||||
}
|
||||
|
|
@ -223,7 +227,7 @@ func (rr *roundRobin) Start(target string, config BalancerConfig) error {
|
|||
return err
|
||||
}
|
||||
rr.w = w
|
||||
rr.addrCh = make(chan []Address)
|
||||
rr.addrCh = make(chan []Address, 1)
|
||||
go func() {
|
||||
for {
|
||||
if err := rr.watchAddrUpdates(); err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue