summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-05-21 09:17:02 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-05-22 13:50:10 +0000
commitae7c45968dd458326814db2218cf6a4b0ca9c7e1 (patch)
tree3fd4f8246942a06401a4d8c52592cec6afcdbda2 /cmd
parent82feafecdda8040432c008d9b79e4f973009adfc (diff)
downloadpodman-ae7c45968dd458326814db2218cf6a4b0ca9c7e1.tar.gz
podman-ae7c45968dd458326814db2218cf6a4b0ca9c7e1.tar.bz2
podman-ae7c45968dd458326814db2218cf6a4b0ca9c7e1.zip
set varlink timeout to 1 seconds
Add option to varlink for --timeout. Input for this option is in milliseconds Signed-off-by: baude <bbaude@redhat.com> Closes: #814 Approved by: baude
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/varlink.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/cmd/podman/varlink.go b/cmd/podman/varlink.go
index a25f776e1..300b5ebe4 100644
--- a/cmd/podman/varlink.go
+++ b/cmd/podman/varlink.go
@@ -1,6 +1,8 @@
package main
import (
+ "time"
+
"github.com/pkg/errors"
ioprojectatomicpodman "github.com/projectatomic/libpod/cmd/podman/varlink"
"github.com/projectatomic/libpod/pkg/varlinkapi"
@@ -15,7 +17,13 @@ var (
run varlink interface
`
- varlinkFlags = []cli.Flag{}
+ varlinkFlags = []cli.Flag{
+ cli.IntFlag{
+ Name: "timeout, t",
+ Usage: "time until the varlink session expires in milliseconds. default is 1 second; 0 means no timeout.",
+ Value: 1000,
+ },
+ }
varlinkCommand = cli.Command{
Name: "varlink",
Usage: "Run varlink interface",
@@ -31,6 +39,7 @@ func varlinkCmd(c *cli.Context) error {
if len(args) < 1 {
return errors.Errorf("you must provide a varlink URI")
}
+ timeout := time.Duration(c.Int64("timeout")) * time.Millisecond
var varlinkInterfaces = []*ioprojectatomicpodman.VarlinkInterface{varlinkapi.New(c)}
// Register varlink service. The metadata can be retrieved with:
@@ -52,7 +61,7 @@ func varlinkCmd(c *cli.Context) error {
}
// Run the varlink server at the given address
- if err = service.Listen(args[0], 0); err != nil {
+ if err = service.Listen(args[0], timeout); err != nil {
return errors.Errorf("unable to start varlink service")
}