summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicah Lee <micah@micahflee.com>2019-01-21 11:16:55 -0800
committerMicah Lee <micah@micahflee.com>2019-01-21 11:16:55 -0800
commit87d94f68e89d4fd42e68183a2aee8a2fffef07b7 (patch)
tree4687b50452bd45d265fb7b9e6237afc45dc8e7cb
parent02538520a20fca491add9cb11b8dd3978ffe4331 (diff)
downloadonionshare-87d94f68e89d4fd42e68183a2aee8a2fffef07b7.tar.gz
onionshare-87d94f68e89d4fd42e68183a2aee8a2fffef07b7.zip
Don't update the GUI at all untless it has been told about the request
-rw-r--r--onionshare/web/receive_mode.py26
1 files changed, 14 insertions, 12 deletions
diff --git a/onionshare/web/receive_mode.py b/onionshare/web/receive_mode.py
index c319ce13..5e332a39 100644
--- a/onionshare/web/receive_mode.py
+++ b/onionshare/web/receive_mode.py
@@ -278,8 +278,6 @@ class ReceiveModeRequest(Request):
# Don't tell the GUI that a request has started until we start receiving files
self.told_gui_about_request = False
- self.web.receive_mode.uploads_in_progress.append(self.upload_id)
-
self.previous_file = None
def _get_file_stream(self, total_content_length, content_type, filename=None, content_length=None):
@@ -294,6 +292,8 @@ class ReceiveModeRequest(Request):
'id': self.upload_id,
'content_length': self.content_length
})
+ self.web.receive_mode.uploads_in_progress.append(self.upload_id)
+
self.told_gui_about_request = True
self.progress[filename] = {
@@ -309,12 +309,13 @@ class ReceiveModeRequest(Request):
"""
super(ReceiveModeRequest, self).close()
try:
- upload_id = self.upload_id
- # Inform the GUI that the upload has finished
- self.web.add_request(self.web.REQUEST_UPLOAD_FINISHED, self.path, {
- 'id': upload_id
- })
- self.web.receive_mode.uploads_in_progress.remove(upload_id)
+ if self.told_gui_about_request:
+ upload_id = self.upload_id
+ # Inform the GUI that the upload has finished
+ self.web.add_request(self.web.REQUEST_UPLOAD_FINISHED, self.path, {
+ 'id': upload_id
+ })
+ self.web.receive_mode.uploads_in_progress.remove(upload_id)
except AttributeError:
pass
@@ -336,10 +337,11 @@ class ReceiveModeRequest(Request):
), end='')
# Update the GUI on the upload progress
- self.web.add_request(self.web.REQUEST_PROGRESS, self.path, {
- 'id': self.upload_id,
- 'progress': self.progress
- })
+ if self.told_gui_about_request:
+ self.web.add_request(self.web.REQUEST_PROGRESS, self.path, {
+ 'id': self.upload_id,
+ 'progress': self.progress
+ })
def file_close_func(self, filename):
"""