Remove unnecessary okhttp close when canceling.

Canceling should handle closing stuff now. And if we close from a
different thread than the calling thread, okhttp will crash.
This commit is contained in:
Greyson Parrelli
2020-03-19 10:04:04 -04:00
parent 453996c374
commit e3ea36c76f
2 changed files with 9 additions and 14 deletions

View File

@@ -13,6 +13,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.SocketException;
public class EncryptedCacheEncoder extends EncryptedCoder implements Encoder<InputStream> {
@@ -42,12 +43,14 @@ public class EncryptedCacheEncoder extends EncryptedCoder implements Encoder<Inp
return true;
} catch (IOException e) {
Log.w(TAG, e);
if (e instanceof SocketException) {
Log.d(TAG, "Socket exception. Likely a cancellation.");
} else {
Log.w(TAG, e);
}
return false;
} finally {
byteArrayPool.put(buffer);
}
}
}