From f8502899614c14de7e3f2c581cce71c5bedcd6fd Mon Sep 17 00:00:00 2001 From: Richard Gooch Date: Mon, 28 Jan 2019 06:45:28 -0800 Subject: [PATCH] Add -connectTimeout option to subtool. --- cmd/subtool/main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/subtool/main.go b/cmd/subtool/main.go index 71e832c4..74e8b879 100644 --- a/cmd/subtool/main.go +++ b/cmd/subtool/main.go @@ -18,6 +18,8 @@ import ( var ( computedFilesRoot = flag.String("computedFilesRoot", "", "Name of directory tree containing computed files") + connectTimeout = flag.Duration("connectTimeout", 15*time.Second, + "connection timeout") cpuPercent = flag.Uint("cpuPercent", 0, "CPU speed as percentage of capacity (default 50)") debug = flag.Bool("debug", false, "Enable debug mode") @@ -99,7 +101,7 @@ func printUsage() { func getSubClient() *srpc.Client { clientName := fmt.Sprintf("%s:%d", *subHostname, *subPortNum) - client, err := srpc.DialHTTP("tcp", clientName, time.Second*5) + client, err := srpc.DialHTTP("tcp", clientName, *connectTimeout) if err != nil { logger.Fatalf("Error dialing %s: %s\n", clientName, err) }