tweak http timeouts so sideshift does not timeout (#881)

This commit is contained in:
m2049r 2023-01-07 10:22:21 +01:00 committed by GitHub
parent ac1ea05ef6
commit cc7cdb383c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -56,7 +56,9 @@ import timber.log.Timber;
@RequiredArgsConstructor @RequiredArgsConstructor
public class NetCipherHelper implements StatusCallback { public class NetCipherHelper implements StatusCallback {
public static final String USER_AGENT = "Monerujo/1.0"; public static final String USER_AGENT = "Monerujo/1.0";
public static final int HTTP_TIMEOUT = 1000; //ms public static final int HTTP_TIMEOUT_CONNECT = 1000; //ms
public static final int HTTP_TIMEOUT_READ = 2000; //ms
public static final int HTTP_TIMEOUT_WRITE = 1000; //ms
public static final int TOR_TIMEOUT_CONNECT = 5000; //ms public static final int TOR_TIMEOUT_CONNECT = 5000; //ms
public static final int TOR_TIMEOUT = 2000; //ms public static final int TOR_TIMEOUT = 2000; //ms
@ -117,9 +119,9 @@ public class NetCipherHelper implements StatusCallback {
private void createClearnetClient() { private void createClearnetClient() {
try { try {
client = new OkHttpClient.Builder() client = new OkHttpClient.Builder()
.connectTimeout(HTTP_TIMEOUT, TimeUnit.MILLISECONDS) .connectTimeout(HTTP_TIMEOUT_CONNECT, TimeUnit.MILLISECONDS)
.writeTimeout(HTTP_TIMEOUT, TimeUnit.MILLISECONDS) .writeTimeout(HTTP_TIMEOUT_WRITE, TimeUnit.MILLISECONDS)
.readTimeout(HTTP_TIMEOUT, TimeUnit.MILLISECONDS) .readTimeout(HTTP_TIMEOUT_READ, TimeUnit.MILLISECONDS)
.build(); .build();
Helper.ALLOW_SHIFT = true; Helper.ALLOW_SHIFT = true;
} catch (Exception ex) { } catch (Exception ex) {