Browse Source

grpcproxy: return closing error when stream is canceled from conn close

Fixes #6630
Anthony Romano 8 years ago
parent
commit
28e9ba365a
1 changed files with 6 additions and 1 deletions
  1. 6 1
      proxy/grpcproxy/watch.go

+ 6 - 1
proxy/grpcproxy/watch.go

@@ -73,7 +73,12 @@ func (wp *watchProxy) Watch(stream pb.Watch_WatchServer) (err error) {
 	select {
 	case <-wp.ctx.Done():
 		wp.mu.Unlock()
-		return
+		select {
+		case <-wp.leader.disconnectNotify():
+			return grpc.ErrClientConnClosing
+		default:
+			return wp.ctx.Err()
+		}
 	default:
 		wp.wg.Add(1)
 	}