From 84a57e570683fde500a352495712df108c91a9da Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Tue, 27 Sep 2016 22:11:09 +0200 Subject: increase ReadTimeouts for HTTP connections and remove the automatic upload retry --- .../java/de/pixart/messenger/http/HttpDownloadConnection.java | 4 ++-- .../java/de/pixart/messenger/http/HttpUploadConnection.java | 10 +++------- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'src/main/java/de/pixart/messenger') diff --git a/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java b/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java index 9a6676154..376ddb0cb 100644 --- a/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java +++ b/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java @@ -221,7 +221,7 @@ public class HttpDownloadConnection implements Transferable { mHttpConnectionManager.setupTrustManager((HttpsURLConnection) connection, interactive); } connection.setConnectTimeout(Config.SOCKET_TIMEOUT * 1000); - connection.setReadTimeout(Config.SOCKET_TIMEOUT * 1000); + connection.setReadTimeout(Config.CONNECT_TIMEOUT * 1000); connection.connect(); String contentLength = connection.getHeaderField("Content-Length"); connection.disconnect(); @@ -291,7 +291,7 @@ public class HttpDownloadConnection implements Transferable { connection.setRequestProperty("Range", "bytes="+size+"-"); } connection.setConnectTimeout(Config.SOCKET_TIMEOUT * 1000); - connection.setReadTimeout(Config.SOCKET_TIMEOUT * 1000); + connection.setReadTimeout(Config.CONNECT_TIMEOUT * 1000); connection.connect(); is = new BufferedInputStream(connection.getInputStream()); boolean serverResumed = "bytes".equals(connection.getHeaderField("Accept-Ranges")); diff --git a/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java b/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java index 0d1448509..d12dde80e 100644 --- a/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java +++ b/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java @@ -89,12 +89,8 @@ public class HttpUploadConnection implements Transferable { private void fail() { mHttpConnectionManager.finishUploadConnection(this); message.setTransferable(null); - if (!canceled && file.getExpectedSize()<=Config.FILE_MAX_SIZE){ - mXmppConnectionService.resendMessage(message, delayed); - } else { - mXmppConnectionService.markMessage(message, Message.STATUS_SEND_FAILED); - FileBackend.close(mFileInputStream); - } + mXmppConnectionService.markMessage(message, Message.STATUS_SEND_FAILED); + FileBackend.close(mFileInputStream); } public void init(Message message, boolean delay) { @@ -178,7 +174,7 @@ public class HttpUploadConnection implements Transferable { connection.setRequestProperty("User-Agent",mXmppConnectionService.getIqGenerator().getIdentityName()); connection.setDoOutput(true); connection.setConnectTimeout(Config.SOCKET_TIMEOUT * 1000); - connection.setReadTimeout(Config.SOCKET_TIMEOUT * 1000); + connection.setReadTimeout(Config.CONNECT_TIMEOUT * 1000); connection.connect(); os = connection.getOutputStream(); transmitted = 0; -- cgit v1.2.3