浏览代码

Merge pull request #6277 from philips/remove-unneeded-time-duration

registry: remove unneeded time.Duration()
unclejack 11 年之前
父节点
当前提交
8f909221f5
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      registry/registry.go

+ 3 - 3
registry/registry.go

@@ -37,12 +37,12 @@ func pingRegistryEndpoint(endpoint string) (RegistryInfo, error) {
 	}
 	httpDial := func(proto string, addr string) (net.Conn, error) {
 		// Set the connect timeout to 5 seconds
-		conn, err := net.DialTimeout(proto, addr, time.Duration(5)*time.Second)
+		conn, err := net.DialTimeout(proto, addr, 5*time.Second)
 		if err != nil {
 			return nil, err
 		}
 		// Set the recv timeout to 10 seconds
-		conn.SetDeadline(time.Now().Add(time.Duration(10) * time.Second))
+		conn.SetDeadline(time.Now().Add(10 * time.Second))
 		return conn, nil
 	}
 	httpTransport := &http.Transport{
@@ -801,7 +801,7 @@ func NewRegistry(authConfig *AuthConfig, factory *utils.HTTPRequestFactory, inde
 			if err != nil {
 				return nil, err
 			}
-			conn = utils.NewTimeoutConn(conn, time.Duration(1)*time.Minute)
+			conn = utils.NewTimeoutConn(conn, 1*time.Minute)
 			return conn, nil
 		}
 	}