From a68be2f67ea5472dd17611e4cd4a4acf6acdef5f Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Thu, 17 May 2018 21:09:46 +0200 Subject: some tor modifications possibly fixes #199 --- src/main/java/de/pixart/messenger/http/HttpConnectionManager.java | 2 +- .../java/de/pixart/messenger/http/HttpDownloadConnection.java | 8 ++++---- src/main/java/de/pixart/messenger/http/HttpUploadConnection.java | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/main/java/de/pixart/messenger/http') diff --git a/src/main/java/de/pixart/messenger/http/HttpConnectionManager.java b/src/main/java/de/pixart/messenger/http/HttpConnectionManager.java index 340bc6d7a..383fe72a5 100644 --- a/src/main/java/de/pixart/messenger/http/HttpConnectionManager.java +++ b/src/main/java/de/pixart/messenger/http/HttpConnectionManager.java @@ -72,7 +72,7 @@ public class HttpConnectionManager extends AbstractConnectionManager { } } - public Proxy getProxy() throws IOException { + public static Proxy getProxy() throws IOException { return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(InetAddress.getByAddress(new byte[]{127, 0, 0, 1}), 8118)); } } diff --git a/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java b/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java index fd2c054c3..2120ab309 100644 --- a/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java +++ b/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java @@ -226,12 +226,12 @@ public class HttpDownloadConnection implements Transferable { private long retrieveFileSize() throws IOException { PowerManager.WakeLock wakeLock = mHttpConnectionManager.createWakeLock("http_download_filesize" + message.getUuid()); try { - WakeLockHelper.acquire(wakeLock); + wakeLock.acquire(); Log.d(Config.LOGTAG, "retrieve file size. interactive:" + String.valueOf(interactive)); changeStatus(STATUS_CHECKING); HttpURLConnection connection; if (mUseTor) { - connection = (HttpURLConnection) mUrl.openConnection(mHttpConnectionManager.getProxy()); + connection = (HttpURLConnection) mUrl.openConnection(HttpConnectionManager.getProxy()); } else { connection = (HttpURLConnection) mUrl.openConnection(); } @@ -299,9 +299,9 @@ public class HttpDownloadConnection implements Transferable { HttpURLConnection connection = null; PowerManager.WakeLock wakeLock = mHttpConnectionManager.createWakeLock("http_download_" + message.getUuid()); try { - WakeLockHelper.acquire(wakeLock); + wakeLock.acquire(); if (mUseTor) { - connection = (HttpURLConnection) mUrl.openConnection(mHttpConnectionManager.getProxy()); + connection = (HttpURLConnection) mUrl.openConnection(HttpConnectionManager.getProxy()); } else { connection = (HttpURLConnection) mUrl.openConnection(); } diff --git a/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java b/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java index fb2d1d49e..e598db080 100644 --- a/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java +++ b/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java @@ -188,7 +188,7 @@ public class HttpUploadConnection implements Transferable { wakeLock.acquire(readTimeout); Log.d(Config.LOGTAG, "uploading to " + mPutUrl.toString() + " w/ read timeout of " + readTimeout + "s"); if (mUseTor) { - connection = (HttpURLConnection) mPutUrl.openConnection(mHttpConnectionManager.getProxy()); + connection = (HttpURLConnection) mPutUrl.openConnection(HttpConnectionManager.getProxy()); } else { connection = (HttpURLConnection) mPutUrl.openConnection(); } -- cgit v1.2.3