revised strategy for http upload read timeout

This commit is contained in:
Daniel Gultsch 2017-06-17 19:53:11 +02:00
parent a1fe8f1c87
commit f67baab983

View file

@ -161,7 +161,7 @@ public class HttpUploadConnection implements Transferable {
try { try {
wakeLock.acquire(); wakeLock.acquire();
final int expectedFileSize = (int) file.getExpectedSize(); 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"); Log.d(Config.LOGTAG, "uploading to " + mPutUrl.toString()+ " w/ read timeout of "+readTimeout+"s");
if (mUseTor) { if (mUseTor) {
connection = (HttpURLConnection) mPutUrl.openConnection(mHttpConnectionManager.getProxy()); connection = (HttpURLConnection) mPutUrl.openConnection(mHttpConnectionManager.getProxy());