JAL-3332 Sensible default timeout values for network connections (8s connect_timeout...
authorBen Soares <bsoares@dundee.ac.uk>
Mon, 1 Jul 2019 14:21:00 +0000 (15:21 +0100)
committerBen Soares <bsoares@dundee.ac.uk>
Mon, 1 Jul 2019 14:21:00 +0000 (15:21 +0100)
20 files changed:
getdown/lib/getdown-core.jar
getdown/lib/getdown-launcher.jar
getdown/src/getdown/ant/pom.xml
getdown/src/getdown/core/pom.xml
getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/Build.java.tmpl
getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/SysProps.java
getdown/src/getdown/launcher/pom.xml
getdown/src/getdown/launcher/src/main/resources/com/threerings/getdown/messages.properties
getdown/src/getdown/launcher/src/main/resources/com/threerings/getdown/messages_de.properties
getdown/src/getdown/launcher/src/main/resources/com/threerings/getdown/messages_es.properties
getdown/src/getdown/launcher/src/main/resources/com/threerings/getdown/messages_fr.properties
getdown/src/getdown/launcher/src/main/resources/com/threerings/getdown/messages_it.properties
getdown/src/getdown/launcher/src/main/resources/com/threerings/getdown/messages_ja.properties
getdown/src/getdown/launcher/src/main/resources/com/threerings/getdown/messages_ko.properties
getdown/src/getdown/launcher/src/main/resources/com/threerings/getdown/messages_pt.properties
getdown/src/getdown/launcher/src/main/resources/com/threerings/getdown/messages_zh.properties
getdown/src/getdown/mvn_cmd
getdown/src/getdown/pom.xml
j11lib/getdown-core.jar
j8lib/getdown-core.jar

index 397dc49..3461a3a 100644 (file)
Binary files a/getdown/lib/getdown-core.jar and b/getdown/lib/getdown-core.jar differ
index f7fcbfc..9a700d7 100644 (file)
Binary files a/getdown/lib/getdown-launcher.jar and b/getdown/lib/getdown-launcher.jar differ
index 7f35d44..a2f95e3 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.threerings.getdown</groupId>
     <artifactId>getdown</artifactId>
-    <version>1.8.3-1.1.2_JVL</version>
+    <version>1.8.3-1.1.4_JVL</version>
   </parent>
 
   <artifactId>getdown-ant</artifactId>
index 2350118..4cd0507 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.threerings.getdown</groupId>
     <artifactId>getdown</artifactId>
-    <version>1.8.3-1.1.2_JVL</version>
+    <version>1.8.3-1.1.4_JVL</version>
   </parent>
 
   <artifactId>getdown-core</artifactId>
@@ -35,6 +35,8 @@
        separated by commas (app1.foo.com,app2.bar.com,app3.baz.com). -->
   <properties>
     <getdown.host.whitelist>jalview.org,*.jalview.org</getdown.host.whitelist>
+    <connect_timeout>8</connect_timeout>
+    <read_timeout>15</read_timeout>
   </properties>
 
   <build>
@@ -83,6 +85,8 @@
                     <filter token="build_time" value="${getdown.build.time}" />
                     <filter token="build_version" value="${project.version}" />
                     <filter token="host_whitelist" value="${getdown.host.whitelist}" />
+                    <filter token="connect_timeout" value="${connect_timeout}" />
+                    <filter token="read_timeout" value="${read_timeout}" />
                   </filterset>
                 </copy>
               </target>
index 60a8ff3..86ea47b 100644 (file)
@@ -40,4 +40,26 @@ public class Build {
     public static List<String> hostWhitelist () {
         return Arrays.asList(StringUtil.parseStringArray("@host_whitelist@"));
     }
+    
+    /*
+     * <p>The default connect_timeout to use.  Overridden by system property of the same name at runtime
+     */
+    public static int defaultConnectTimeout () {
+       try {
+                       return Integer.valueOf("@connect_timeout@");
+               } catch (Exception e) {
+                       return 0;
+               }
+    }
+    
+    /*
+     * <p>The default read_timeout to use.  Overridden by system property of the same name at runtime
+     */
+    public static int defaultReadTimeout () {
+       try {
+                       return Integer.valueOf("@read_timeout@");
+               } catch (Exception e) {
+                       return 30;
+               }
+    }
 }
index 0d96ecb..8550461 100644 (file)
@@ -9,6 +9,7 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import com.threerings.getdown.util.VersionUtil;
+import com.threerings.getdown.data.Build;
 
 /**
  * This class encapsulates all system properties that are read and processed by Getdown. Don't
@@ -106,7 +107,7 @@ public class SysProps
       * 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);
+        return Integer.getInteger("connect_timeout", Build.defaultConnectTimeout());
     }
 
     /** Specifies the read timeout (in seconds) to use when downloading all files from the server.
@@ -114,7 +115,7 @@ public class SysProps
       * update process wil fail. Setting the timeout to zero (or a negative value) will disable it.
       * Usage: {@code -Dread_timeout=N}. */
     public static int readTimeout () {
-        return Integer.getInteger("read_timeout", 30);
+        return Integer.getInteger("read_timeout", Build.defaultReadTimeout());
     }
 
     /** Returns the number of threads used to perform digesting and verifying operations in
index b809235..4c6b982 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.threerings.getdown</groupId>
     <artifactId>getdown</artifactId>
-    <version>1.8.3-1.1.2_JVL</version>
+    <version>1.8.3-1.1.4_JVL</version>
   </parent>
 
   <artifactId>getdown-launcher</artifactId>
index 6a14aea..fd7c716 100755 (executable)
@@ -3,7 +3,7 @@
 if [ x$JVLVERSION != x ]; then
   export VERSION=$JVLVERSION
 else
-  export VERSION=1.8.3-1.0_JVL
+  export VERSION=1.8.3-1.1.4_JVL
 fi
 
 if [ x${VERSION%_JVL} = x$VERSION ]; then
@@ -14,7 +14,7 @@ echo "Setting VERSION to '$VERSION'"
 
 perl -p -i -e 's|(<version>)[^<]*JVL[^<]*(</version>)|${1}$ENV{VERSION}${2}|;' pom.xml */pom.xml
 
-mvn package -Dgetdown.host.whitelist="jalview.org,*.jalview.org"
+mvn package -Dgetdown.host.whitelist="jalview.org,*.jalview.org" -Dconnect_timeout=8 -Dread_timeout=15
 RET=$?
 if [ x$RET = x0 ]; then
   cp launcher/target/getdown-launcher-$VERSION.jar ../../../getdown/lib/getdown-launcher.jar && echo "Copied getdown-launcher.jar to getdown/lib"
index 64555e0..24efba8 100644 (file)
@@ -10,7 +10,7 @@
   <groupId>com.threerings.getdown</groupId>
   <artifactId>getdown</artifactId>
   <packaging>pom</packaging>
-  <version>1.8.3-1.1.2_JVL</version>
+  <version>1.8.3-1.1.4_JVL</version>
 
   <name>getdown</name>
   <description>An application installer and updater.</description>
index 397dc49..3461a3a 100644 (file)
Binary files a/j11lib/getdown-core.jar and b/j11lib/getdown-core.jar differ
index 397dc49..3461a3a 100644 (file)
Binary files a/j8lib/getdown-core.jar and b/j8lib/getdown-core.jar differ