diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/de/pixart/messenger/Config.java | 2 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/http/HttpUploadConnection.java | 6 |
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(); |