Added support for configuring a connect timeout when downloading metafiles.
This commit is contained in:
@@ -1509,6 +1509,11 @@ public class Application
|
|||||||
// about it; turning off caches is not a performance concern, because when Getdown asks
|
// about it; turning off caches is not a performance concern, because when Getdown asks
|
||||||
// to download a file, it expects it to come over the wire, not from a cache
|
// to download a file, it expects it to come over the wire, not from a cache
|
||||||
uconn.setUseCaches(false);
|
uconn.setUseCaches(false);
|
||||||
|
// configure a connect timeout if requested
|
||||||
|
int ctimeout = SysProps.connectTimeout();
|
||||||
|
if (ctimeout > 0) {
|
||||||
|
uconn.setConnectTimeout(ctimeout * 1000);
|
||||||
|
}
|
||||||
fin = uconn.getInputStream();
|
fin = uconn.getInputStream();
|
||||||
fout = new FileOutputStream(target);
|
fout = new FileOutputStream(target);
|
||||||
StreamUtil.copy(fin, fout);
|
StreamUtil.copy(fin, fout);
|
||||||
|
|||||||
@@ -65,4 +65,12 @@ public class SysProps
|
|||||||
public static boolean direct () {
|
public static boolean direct () {
|
||||||
return Boolean.getBoolean("direct");
|
return Boolean.getBoolean("direct");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Specifies the connection timeout (in seconds) to use when downloading control files from
|
||||||
|
* the server. This is chiefly useful when you are running in versionless mode and want Getdown
|
||||||
|
* to more quickly timeout its startup update check if the server with which it is
|
||||||
|
* communicating is not available. Usage: {@code -Dconnect_timeout=N}. */
|
||||||
|
public static int connectTimeout () {
|
||||||
|
return Integer.getInteger("connect_timeout", 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user