瀏覽代碼

Remove use OkHttp default connection pool timeout #72

Ben Hsieh 8 年之前
父節點
當前提交
195499afca
共有 1 個檔案被更改,包括 5 行新增1 行删除
  1. 5
    1
      src/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java

+ 5
- 1
src/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java 查看文件

@@ -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();