1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

Add timeout to last chunk

This commit is contained in:
davigonz 2018-07-02 10:08:12 +02:00
parent 762ae7eb62
commit ed073d6db0

View File

@ -35,6 +35,7 @@ import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;
import java.util.concurrent.TimeUnit;
import okhttp3.MediaType;
@ -118,12 +119,12 @@ public class ChunkedUploadRemoteFileOperation extends UploadRemoteFileOperation
// // next method will throw an exception
// }
// if (chunkIndex == chunkCount - 1) {
// // Added a high timeout to the last chunk due to when the last chunk
// // arrives to the server with the last PUT, all chunks get assembled
// // within that PHP request, so last one takes longer.
// mPutMethod.getParams().setSoTimeout(LAST_CHUNK_TIMEOUT);
// }
if (chunkIndex == chunkCount - 1) {
// Added a high timeout to the last chunk due to when the last chunk
// arrives to the server with the last PUT, all chunks get assembled
// within that PHP request, so last one takes longer.
mPutMethod.setReadTimeout(LAST_CHUNK_TIMEOUT, TimeUnit.MILLISECONDS);
}
mPutMethod.setRequestBody(mFileRequestBody);