some fixes
This commit is contained in:
@ -233,7 +233,6 @@ func Dial(target string, opts ...DialOption) (*ClientConn, error) {
|
|||||||
cc.balancer = RoundRobin()
|
cc.balancer = RoundRobin()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the first connection
|
|
||||||
if cc.dopts.resolver == nil {
|
if cc.dopts.resolver == nil {
|
||||||
addr := Address{
|
addr := Address{
|
||||||
Addr: cc.target,
|
Addr: cc.target,
|
||||||
@ -251,10 +250,11 @@ func Dial(target string, opts ...DialOption) (*ClientConn, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
cc.watcher = w
|
cc.watcher = w
|
||||||
// Get the initial name resolution which starts dialing.
|
// Get the initial name resolution and dial the first connection.
|
||||||
if err := cc.watchAddrUpdates(); err != nil {
|
if err := cc.watchAddrUpdates(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
// Start a goroutine to watch for the future name resolution changes.
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
if err := cc.watchAddrUpdates(); err != nil {
|
if err := cc.watchAddrUpdates(); err != nil {
|
||||||
@ -338,7 +338,6 @@ func (cc *ClientConn) watchAddrUpdates() error {
|
|||||||
cc.mu.Unlock()
|
cc.mu.Unlock()
|
||||||
ac, err := cc.newAddrConn(addr)
|
ac, err := cc.newAddrConn(addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cc.mu.Unlock()
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
cc.mu.Lock()
|
cc.mu.Lock()
|
||||||
@ -359,7 +358,6 @@ func (cc *ClientConn) watchAddrUpdates() error {
|
|||||||
delete(cc.conns, addr)
|
delete(cc.conns, addr)
|
||||||
cc.mu.Unlock()
|
cc.mu.Unlock()
|
||||||
ac.tearDown(ErrConnDrain)
|
ac.tearDown(ErrConnDrain)
|
||||||
//ac.startDrain()
|
|
||||||
default:
|
default:
|
||||||
grpclog.Println("Unknown update.Op ", update.Op)
|
grpclog.Println("Unknown update.Op ", update.Op)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user