mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
[FIX] OutOfMemory при скачивании с certificatePinning
This commit is contained in:
parent
3ccb0c5c8a
commit
7154989827
1 changed files with 4 additions and 1 deletions
|
@ -31,6 +31,7 @@ public class AsyncDownloader {
|
||||||
public final Callback callback;
|
public final Callback callback;
|
||||||
@LauncherInject("launcher.certificatePinning")
|
@LauncherInject("launcher.certificatePinning")
|
||||||
private static boolean isCertificatePinning;
|
private static boolean isCertificatePinning;
|
||||||
|
private static volatile SSLSocketFactory sslSocketFactory;
|
||||||
|
|
||||||
public AsyncDownloader(Callback callback) {
|
public AsyncDownloader(Callback callback) {
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
|
@ -71,9 +72,11 @@ public void downloadFile(URL url, Path target) throws IOException {
|
||||||
}
|
}
|
||||||
|
|
||||||
public SSLSocketFactory makeSSLSocketFactory() throws NoSuchAlgorithmException, CertificateException, KeyStoreException, IOException, KeyManagementException {
|
public SSLSocketFactory makeSSLSocketFactory() throws NoSuchAlgorithmException, CertificateException, KeyStoreException, IOException, KeyManagementException {
|
||||||
|
if(sslSocketFactory != null) return sslSocketFactory;
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
sslContext.init(null, CertificatePinningTrustManager.getTrustManager().getTrustManagers(), new SecureRandom());
|
sslContext.init(null, CertificatePinningTrustManager.getTrustManager().getTrustManagers(), new SecureRandom());
|
||||||
return sslContext.getSocketFactory();
|
sslSocketFactory = sslContext.getSocketFactory();
|
||||||
|
return sslSocketFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void downloadListInOneThread(List<SizedFile> files, String baseURL, Path targetDir) throws URISyntaxException, IOException {
|
public void downloadListInOneThread(List<SizedFile> files, String baseURL, Path targetDir) throws URISyntaxException, IOException {
|
||||||
|
|
Loading…
Reference in a new issue