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 { | 	if rr.done { | ||||||
| 		return ErrClientConnClosing | 		return ErrClientConnClosing | ||||||
| 	} | 	} | ||||||
|  | 	select { | ||||||
|  | 	case <-rr.addrCh: | ||||||
|  | 	default: | ||||||
|  | 	} | ||||||
| 	rr.addrCh <- open | 	rr.addrCh <- open | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
|  | @ -223,7 +227,7 @@ func (rr *roundRobin) Start(target string, config BalancerConfig) error { | ||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
| 	rr.w = w | 	rr.w = w | ||||||
| 	rr.addrCh = make(chan []Address) | 	rr.addrCh = make(chan []Address, 1) | ||||||
| 	go func() { | 	go func() { | ||||||
| 		for { | 		for { | ||||||
| 			if err := rr.watchAddrUpdates(); err != nil { | 			if err := rr.watchAddrUpdates(); err != nil { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue