@@ -1023,11 +1023,14 @@ public final static class Configuration {
10231023 // Fetching
10241024 public final boolean retryOnChunkError ;
10251025
1026+ // Network
1027+ public final int connectionTimeout ;
1028+
10261029 private Configuration (boolean proxyEnabled , Proxy .Type proxyType , String proxyAddress , int proxyPort , boolean proxyAuth , String proxyUsername , String proxyPassword ,
10271030 TimeProvider .Method timeSynchronizationMethod , int timeManualCorrection ,
10281031 boolean cacheEnabled , File cacheDir , boolean doCacheCleanUp ,
10291032 boolean storeCredentials , File storedCredentialsFile ,
1030- boolean retryOnChunkError ) {
1033+ boolean retryOnChunkError , int connectionTimeout ) {
10311034 this .proxyEnabled = proxyEnabled ;
10321035 this .proxyType = proxyType ;
10331036 this .proxyAddress = proxyAddress ;
@@ -1043,6 +1046,7 @@ private Configuration(boolean proxyEnabled, Proxy.Type proxyType, String proxyAd
10431046 this .storeCredentials = storeCredentials ;
10441047 this .storedCredentialsFile = storedCredentialsFile ;
10451048 this .retryOnChunkError = retryOnChunkError ;
1049+ this .connectionTimeout = connectionTimeout ;
10461050 }
10471051
10481052 public static final class Builder {
@@ -1071,6 +1075,9 @@ public static final class Builder {
10711075 // Fetching
10721076 private boolean retryOnChunkError ;
10731077
1078+ // Network
1079+ private int connectionTimeout ;
1080+
10741081 public Builder () {
10751082 }
10761083
@@ -1149,13 +1156,18 @@ public Builder setRetryOnChunkError(boolean retryOnChunkError) {
11491156 return this ;
11501157 }
11511158
1159+ public Builder setConnectionTimeout (int connectionTimeout ) {
1160+ this .connectionTimeout = connectionTimeout ;
1161+ return this ;
1162+ }
1163+
11521164 @ NotNull
11531165 public Configuration build () {
11541166 return new Configuration (proxyEnabled , proxyType , proxyAddress , proxyPort , proxyAuth , proxyUsername , proxyPassword ,
11551167 timeSynchronizationMethod , timeManualCorrection ,
11561168 cacheEnabled , cacheDir , doCacheCleanUp ,
11571169 storeCredentials , storedCredentialsFile ,
1158- retryOnChunkError );
1170+ retryOnChunkError , connectionTimeout );
11591171 }
11601172 }
11611173 }
@@ -1298,7 +1310,7 @@ public void run() {
12981310 scheduledReconnect = scheduler .schedule (() -> {
12991311 LOGGER .warn ("Socket timed out. Reconnecting..." );
13001312 reconnect ();
1301- }, 2 * 60 + 5 , TimeUnit .SECONDS );
1313+ }, 2 * 60 + configuration (). connectionTimeout , TimeUnit .SECONDS );
13021314
13031315 TimeProvider .updateWithPing (packet .payload );
13041316
0 commit comments