revised strategy for http upload read timeout

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java | 2 
1 file changed, 1 insertion(+), 1 deletion(-)

Detailed changes

src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java 🔗

@@ -161,7 +161,7 @@ public class HttpUploadConnection implements Transferable {
 			try {
 				wakeLock.acquire();
 				final int expectedFileSize = (int) file.getExpectedSize();
-				final int readTimeout = Math.max(Config.SOCKET_TIMEOUT,expectedFileSize / 2048); //assuming a minimum transfer speed of 16kbit/s
+				final int readTimeout = (expectedFileSize / 2048) + Config.SOCKET_TIMEOUT; //assuming a minimum transfer speed of 16kbit/s
 				Log.d(Config.LOGTAG, "uploading to " + mPutUrl.toString()+ " w/ read timeout of "+readTimeout+"s");
 				if (mUseTor) {
 					connection = (HttpURLConnection) mPutUrl.openConnection(mHttpConnectionManager.getProxy());