aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-02-04 19:31:28 +0100
committerChristian Schneppe <christian@pix-art.de>2019-02-04 19:31:28 +0100
commit3eea84269d2ab7dc921236b24f334b1279e1f50f (patch)
treeae1a840d5baedfbf0715ecb8287fdcb465deeec6 /src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java
parentdd8d63be4c584e6aadb6f56aa920cb1bec16e4ea (diff)
make sure that http upload/download is not startetd multiple times
Diffstat (limited to 'src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java')
-rw-r--r--src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java b/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java
index 102a11626..1074c1982 100644
--- a/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java
+++ b/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java
@@ -41,7 +41,7 @@ public class HttpDownloadConnection implements Transferable {
private XmppConnectionService mXmppConnectionService;
private URL mUrl;
- private Message message;
+ private final Message message;
private DownloadableFile file;
private int mStatus = Transferable.STATUS_UNKNOWN;
private boolean acceptedAutomatically = false;
@@ -51,8 +51,8 @@ public class HttpDownloadConnection implements Transferable {
private Method method = Method.HTTP_UPLOAD;
private final SimpleDateFormat fileDateFormat = new SimpleDateFormat("yyyyMMdd_HHmmssSSS", Locale.US);
-
- HttpDownloadConnection(HttpConnectionManager manager) {
+ HttpDownloadConnection(Message message, HttpConnectionManager manager) {
+ this.message = message;
this.mHttpConnectionManager = manager;
this.mXmppConnectionService = manager.getXmppConnectionService();
this.mUseTor = mXmppConnectionService.useTorToConnect();
@@ -72,12 +72,7 @@ public class HttpDownloadConnection implements Transferable {
}
}
- public void init(Message message) {
- init(message, false);
- }
-
- public void init(Message message, boolean interactive) {
- this.message = message;
+ public void init(boolean interactive) {
this.message.setTransferable(this);
try {
if (message.hasFileOnRemoteHost()) {
@@ -201,6 +196,10 @@ public class HttpDownloadConnection implements Transferable {
return this.mProgress;
}
+ public Message getMessage() {
+ return message;
+ }
+
private class FileSizeChecker implements Runnable {
private final boolean interactive;
@@ -467,4 +466,4 @@ public class HttpDownloadConnection implements Transferable {
}
}
-}
+} \ No newline at end of file