diff --git a/clientv3/client.go b/clientv3/client.go index 57af96c2aecf..0a578307b450 100644 --- a/clientv3/client.go +++ b/clientv3/client.go @@ -233,8 +233,9 @@ func (c *Client) processCreds(scheme string) (creds *credentials.TransportCreden func (c *Client) dialSetupOpts(creds *credentials.TransportCredentials, dopts ...grpc.DialOption) (opts []grpc.DialOption, err error) { if c.cfg.DialKeepAliveTime > 0 { params := keepalive.ClientParameters{ - Time: c.cfg.DialKeepAliveTime, - Timeout: c.cfg.DialKeepAliveTimeout, + Time: c.cfg.DialKeepAliveTime, + Timeout: c.cfg.DialKeepAliveTimeout, + PermitWithoutStream: c.cfg.PermitWithoutStream, } opts = append(opts, grpc.WithKeepaliveParams(params)) } diff --git a/clientv3/config.go b/clientv3/config.go index 4cea369076ef..bda60b8e703f 100644 --- a/clientv3/config.go +++ b/clientv3/config.go @@ -78,6 +78,9 @@ type Config struct { // If nil, use the default logger. // TODO: configure gRPC logger LogConfig *zap.Config + + // PermitWithoutStream, if set true, client can send keepalive pings to server without any active streams(RPCs). + PermitWithoutStream bool `json:"permit-without-stream"` } // DefaultLogConfig is the default client logging configuration.