Browse Source

grpcproxy: fix "grpc.ErrClientConnClosing" handling

Fix

```
go test -v -tags cluster_proxy -run TestWatchErrConnClosed
```

with gRPC >= v1.10

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Gyuho Lee 7 years ago
parent
commit
d922069713
1 changed files with 1 additions and 3 deletions
  1. 1 3
      proxy/grpcproxy/leader.go

+ 1 - 3
proxy/grpcproxy/leader.go

@@ -20,10 +20,8 @@ import (
 	"sync"
 	"sync"
 
 
 	"github.com/coreos/etcd/clientv3"
 	"github.com/coreos/etcd/clientv3"
-	"github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes"
 
 
 	"golang.org/x/time/rate"
 	"golang.org/x/time/rate"
-	"google.golang.org/grpc"
 )
 )
 
 
 const (
 const (
@@ -69,7 +67,7 @@ func (l *leader) recvLoop() {
 		}
 		}
 		if cresp.Err() != nil {
 		if cresp.Err() != nil {
 			l.loseLeader()
 			l.loseLeader()
-			if rpctypes.ErrorDesc(cresp.Err()) == grpc.ErrClientConnClosing.Error() {
+			if clientv3.IsConnCanceled(cresp.Err()) {
 				close(l.disconnc)
 				close(l.disconnc)
 				return
 				return
 			}
 			}