aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-06-08 10:46:35 +0200
committerChristian Schneppe <christian@pix-art.de>2019-06-08 10:47:30 +0200
commit117513ce418b0c10af9fe4864761dec3895d2dc2 (patch)
tree56f26a97b52551b5b44ad62922d008af7f5c8a4a
parentd5163d0a8b5f3ec2d350a69473846cef64590a10 (diff)
change minimum timeout for uploads/downloads
-rw-r--r--src/main/java/de/pixart/messenger/Config.java2
-rw-r--r--src/main/java/de/pixart/messenger/http/HttpUploadConnection.java6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/Config.java b/src/main/java/de/pixart/messenger/Config.java
index 3bc7f6ef7..19b40c09f 100644
--- a/src/main/java/de/pixart/messenger/Config.java
+++ b/src/main/java/de/pixart/messenger/Config.java
@@ -75,7 +75,7 @@ public final class Config {
public static final int PING_MIN_INTERVAL = 30;
public static final int LOW_PING_TIMEOUT = 1; // used after push received
public static final int PING_TIMEOUT = 15;
- public static final int SOCKET_TIMEOUT = 15;
+ public static final int SOCKET_TIMEOUT = 30;
public static final int CONNECT_TIMEOUT = 60;
public static final int POST_CONNECTIVITY_CHANGE_PING_INTERVAL = 30;
public static final int CONNECT_DISCO_TIMEOUT = 30;
diff --git a/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java b/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java
index 54d6fcb1a..609ad65d3 100644
--- a/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java
+++ b/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java
@@ -156,9 +156,9 @@ public class HttpUploadConnection implements Transferable {
try {
fileInputStream = new FileInputStream(file);
final int expectedFileSize = (int) file.getExpectedSize();
- final int readTimeout = (expectedFileSize / 2048) + Config.SOCKET_TIMEOUT; //assuming a minimum transfer speed of 16kbit/s
+ final int readTimeout = ((expectedFileSize / 2048) + Config.SOCKET_TIMEOUT) * 1000; //assuming a minimum transfer speed of 16kbit/s
wakeLock.acquire(readTimeout);
- Log.d(Config.LOGTAG, "uploading to " + slot.getPutUrl().toString() + " w/ read timeout of " + readTimeout + "s");
+ Log.d(Config.LOGTAG, "uploading to " + slot.getPutUrl().toString() + " w/ read timeout of " + readTimeout / 1000 + "s");
if (mUseTor || message.getConversation().getAccount().isOnion()) {
connection = (HttpURLConnection) slot.getPutUrl().openConnection(HttpConnectionManager.getProxy());
} else {
@@ -179,7 +179,7 @@ public class HttpUploadConnection implements Transferable {
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setConnectTimeout(Config.SOCKET_TIMEOUT * 1000);
- connection.setReadTimeout(readTimeout * 1000);
+ connection.setReadTimeout(readTimeout);
connection.connect();
final InputStream innerInputStream = AbstractConnectionManager.upgrade(file, fileInputStream, true);
os = connection.getOutputStream();