Pārlūkot izejas kodu

Remove use OkHttp default connection pool timeout #72

Ben Hsieh 8 gadus atpakaļ
vecāks
revīzija
195499afca

+ 5
- 1
src/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java Parādīt failu

@@ -75,7 +75,7 @@ public class RNFetchBlobReq extends BroadcastReceiver implements Runnable {
75 75
     public static HashMap<String, Call> taskTable = new HashMap<>();
76 76
     static HashMap<String, Boolean> progressReport = new HashMap<>();
77 77
     static HashMap<String, Boolean> uploadProgressReport = new HashMap<>();
78
-    static ConnectionPool pool = new ConnectionPool(5, 30000, TimeUnit.MILLISECONDS);
78
+    static ConnectionPool pool = new ConnectionPool();
79 79
 
80 80
     MediaType contentType = RNFetchBlobConst.MIME_OCTET;
81 81
     ReactApplicationContext ctx;
@@ -315,6 +315,10 @@ public class RNFetchBlobReq extends BroadcastReceiver implements Runnable {
315 315
                 clientBuilder.connectTimeout(options.timeout, TimeUnit.MILLISECONDS);
316 316
                 clientBuilder.readTimeout(options.timeout, TimeUnit.MILLISECONDS);
317 317
             }
318
+            else {
319
+                clientBuilder.connectTimeout(-1, TimeUnit.MILLISECONDS);
320
+                clientBuilder.readTimeout(-1, TimeUnit.MILLISECONDS);
321
+            }
318 322
             clientBuilder.connectionPool(pool);
319 323
             clientBuilder.retryOnConnectionFailure(false);
320 324
             OkHttpClient client = clientBuilder.build();