Remove connection idle timeout seconds for now (#379)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2020-09-19 14:01:49 -04:00
1 parent e002326293
commit 5bf555cca2
27 files changed
+296 -480

No files matched your search

+2 -2
View File
@@ -289,8 +289,8 @@ func (c *Command) Run(args []string) int {
transport := cleanhttp.DefaultTransport()
transport.DisableKeepAlives = false
transport.TLSClientConfig = tlsConf
// This isn't/shouldn't used anyways really because the connection is hijacked, just
// setting for completeness
// This isn't/shouldn't used anyways really because the connection is
// hijacked, just setting for completeness
transport.IdleConnTimeout = 0
listener, err := net.ListenTCP("tcp", &net.TCPAddr{
+8 -9
View File
@@ -13,15 +13,14 @@ func generateTargetTableOutput(in *targets.Target) string {
var ret []string
nonAttributeMap := map[string]interface{}{
"ID": in.Id,
"Scope ID": in.Scope.Id,
"Version": in.Version,
"Type": in.Type,
"Created Time": in.CreatedTime.Local().Format(time.RFC3339),
"Updated Time": in.UpdatedTime.Local().Format(time.RFC3339),
"Connection Idle Timeout Seconds": in.ConnectionIdleTimeoutSeconds,
"Session Connection Limit": in.SessionConnectionLimit,
"Session Max Seconds": in.SessionMaxSeconds,
"ID": in.Id,
"Scope ID": in.Scope.Id,
"Version": in.Version,
"Type": in.Type,
"Created Time": in.CreatedTime.Local().Format(time.RFC3339),
"Updated Time": in.UpdatedTime.Local().Format(time.RFC3339),
"Session Connection Limit": in.SessionConnectionLimit,
"Session Max Seconds": in.SessionMaxSeconds,
}
if in.Name != "" {
+6 -33
View File
@@ -22,11 +22,10 @@ var _ cli.CommandAutocomplete = (*TcpCommand)(nil)
type TcpCommand struct {
*base.Command
Func string
flagDefaultPort string
flagSessionMaxSeconds string
flagSessionConnectionLimit string
flagConnectionIdleTimeoutSeconds string
Func string
flagDefaultPort string
flagSessionMaxSeconds string
flagSessionConnectionLimit string
}
func (c *TcpCommand) Synopsis() string {
@@ -34,8 +33,8 @@ func (c *TcpCommand) Synopsis() string {
}
var tcpFlagsMap = map[string][]string{
"create": {"scope-id", "name", "description", "default-port", "session-max-seconds", "session-connection-limit", "connection-idle-timeout-seconds"},
"update": {"id", "name", "description", "version", "default-port", "session-max-seconds", "session-connection-limit", "connection-idle-timeout-seconds"},
"create": {"scope-id", "name", "description", "default-port", "session-max-seconds", "session-connection-limit"},
"update": {"id", "name", "description", "version", "default-port", "session-max-seconds", "session-connection-limit"},
}
func (c *TcpCommand) Help() string {
@@ -92,12 +91,6 @@ func (c *TcpCommand) Flags() *base.FlagSets {
Target: &c.flagSessionConnectionLimit,
Usage: "The maximum number of connections allowed for a session. 0 means unlimited.",
})
case "connection-idle-timeout-seconds":
f.StringVar(&base.StringVar{
Name: "connection-idle-timeout-seconds",
Target: &c.flagConnectionIdleTimeoutSeconds,
Usage: `Time period after which the connection will be disconnected if there is no network traffic. Can be specified as an integer number of seconds or a duration string. 0 means unlimited.`,
})
}
}
@@ -203,26 +196,6 @@ func (c *TcpCommand) Run(args []string) int {
opts = append(opts, targets.WithSessionConnectionLimit(uint32(limit)))
}
switch c.flagConnectionIdleTimeoutSeconds {
case "":
case "null":
opts = append(opts, targets.DefaultConnectionIdleTimeoutSeconds())
default:
var final uint32
dur, err := strconv.ParseUint(c.flagConnectionIdleTimeoutSeconds, 10, 32)
if err == nil {
final = uint32(dur)
} else {
dur, err := time.ParseDuration(c.flagConnectionIdleTimeoutSeconds)
if err != nil {
c.UI.Error(fmt.Sprintf("Error parsing %q: %s", c.flagConnectionIdleTimeoutSeconds, err))
return 1
}
final = uint32(dur.Seconds())
}
opts = append(opts, targets.WithConnectionIdleTimeoutSeconds(final))
}
targetClient := targets.NewClient(client)
// Perform check-and-set when needed