diff --git a/golang/conn.go b/golang/conn.go index 75b30b62c..7b52e02bf 100644 --- a/golang/conn.go +++ b/golang/conn.go @@ -26,7 +26,6 @@ import ( validator "github.com/go-playground/validator/v10" "google.golang.org/grpc" "google.golang.org/grpc/credentials" - "google.golang.org/grpc/keepalive" ) var ( @@ -107,13 +106,6 @@ func (c *clientConn) Close() error { } func (c *clientConn) dialSetupOpts(dopts ...grpc.DialOption) (opts []grpc.DialOption, err error) { - if c.opts.DialKeepAliveTime > 0 { - opts = append(opts, grpc.WithKeepaliveParams(keepalive.ClientParameters{ - Time: c.opts.DialKeepAliveTime, - Timeout: c.opts.DialKeepAliveTimeout, - PermitWithoutStream: c.opts.PermitWithoutStream, - })) - } opts = append(opts, dopts...) if c.creds != nil { opts = append(opts, grpc.WithTransportCredentials(c.creds)) diff --git a/golang/conn_options.go b/golang/conn_options.go index 2f59432d5..a3ec09d93 100644 --- a/golang/conn_options.go +++ b/golang/conn_options.go @@ -53,17 +53,6 @@ type connOptions struct { // other operations that do not have an explicit context. Context context.Context - // DialKeepAliveTime is the time after which client pings the server to see if - // transport is alive. - DialKeepAliveTime time.Duration - - // DialKeepAliveTimeout is the time that the client waits for a response for the - // keep-alive probe. If the response is not received in this time, the connection is closed. - DialKeepAliveTimeout time.Duration - - // PermitWithoutStream when set will allow client to send keepalive pings to server without any active streams(RPCs). - PermitWithoutStream bool - // DialTimeout is the timeout for failing to establish a connection. DialTimeout time.Duration @@ -79,7 +68,6 @@ var defaultConnOptions = connOptions{ RootCAs: x509.NewCertPool(), InsecureSkipVerify: true, }, - DialKeepAliveTime: time.Second * 30, Logger: zaplog.New(), } @@ -157,32 +145,6 @@ func WithContext(ctx context.Context) ConnOption { }) } -// WithDialKeepAliveTime returns a ConnOption that sets DialKeepAliveTime for grpc.DialContext. -// DialKeepAliveTime is the time after which client pings the server to see if transport is alive. -func WithDialKeepAliveTime(d time.Duration) ConnOption { - return newFuncConnOption(func(o *connOptions) { - o.DialKeepAliveTime = d - }) -} - -// WithDialKeepAliveTimeout returns a ConnOption that sets DialKeepAliveTimeout for grpc.DialContext. -// DialKeepAliveTimeout is the time that the client waits for a response for the keep-alive probe. -// If the response is not received in this time, the connection is closed. -func WithDialKeepAliveTimeout(d time.Duration) ConnOption { - return newFuncConnOption(func(o *connOptions) { - o.DialKeepAliveTimeout = d - }) -} - -// WithPermitWithoutStream returns a ConnOption that sets PermitWithoutStream for grpc.DialContext. -// PermitWithoutStream when set will allow client to send keepalive pings to server without any -// active streams(RPCs). -func WithPermitWithoutStream(permit bool) ConnOption { - return newFuncConnOption(func(o *connOptions) { - o.PermitWithoutStream = permit - }) -} - func WithZapLogger(logger *zap.Logger) ConnOption { return newFuncConnOption(func(o *connOptions) { o.Logger = logger