Browse Source

Remove use OkHttp default connection pool timeout #72

Ben Hsieh 8 years ago
parent
commit
195499afca
1 changed files with 5 additions and 1 deletions
  1. 5
    1
      src/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java

+ 5
- 1
src/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java View File

75
     public static HashMap<String, Call> taskTable = new HashMap<>();
75
     public static HashMap<String, Call> taskTable = new HashMap<>();
76
     static HashMap<String, Boolean> progressReport = new HashMap<>();
76
     static HashMap<String, Boolean> progressReport = new HashMap<>();
77
     static HashMap<String, Boolean> uploadProgressReport = new HashMap<>();
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
     MediaType contentType = RNFetchBlobConst.MIME_OCTET;
80
     MediaType contentType = RNFetchBlobConst.MIME_OCTET;
81
     ReactApplicationContext ctx;
81
     ReactApplicationContext ctx;
315
                 clientBuilder.connectTimeout(options.timeout, TimeUnit.MILLISECONDS);
315
                 clientBuilder.connectTimeout(options.timeout, TimeUnit.MILLISECONDS);
316
                 clientBuilder.readTimeout(options.timeout, TimeUnit.MILLISECONDS);
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
             clientBuilder.connectionPool(pool);
322
             clientBuilder.connectionPool(pool);
319
             clientBuilder.retryOnConnectionFailure(false);
323
             clientBuilder.retryOnConnectionFailure(false);
320
             OkHttpClient client = clientBuilder.build();
324
             OkHttpClient client = clientBuilder.build();