Skip to content

Commit

Permalink
Merge pull request #4737 from nozzle/grpc-keepalive-flag
Browse files Browse the repository at this point in the history
servenv: add new keepalive flag to grpc server
  • Loading branch information
sougou authored Mar 19, 2019
2 parents b7165dc + 94ab760 commit ae47a53
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion go/vt/servenv/grpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ var (
// This is the minimum amount of time a client should wait before sending a keepalive ping.
GRPCKeepAliveEnforcementPolicyMinTime = flag.Duration("grpc_server_keepalive_enforcement_policy_min_time", 5*time.Minute, "grpc server minimum keepalive time")

// EnforcementPolicy PermitWithoutStream - If true, server allows keepalive pings
// even when there are no active streams (RPCs). If false, and client sends ping when
// there are no active streams, server will send GOAWAY and close the connection.
GRPCKeepAliveEnforcementPolicyPermitWithoutStream = flag.Bool("grpc_server_keepalive_enforcement_policy_permit_without_stream", false, "grpc server permit client keepalive pings even when there are no active streams (RPCs)")

authPlugin Authenticator
)

Expand Down Expand Up @@ -148,7 +153,8 @@ func createGRPCServer() {
}

ep := keepalive.EnforcementPolicy{
MinTime: *GRPCKeepAliveEnforcementPolicyMinTime,
MinTime: *GRPCKeepAliveEnforcementPolicyMinTime,
PermitWithoutStream: *GRPCKeepAliveEnforcementPolicyPermitWithoutStream,
}
opts = append(opts, grpc.KeepaliveEnforcementPolicy(ep))

Expand Down

0 comments on commit ae47a53

Please sign in to comment.