diff options
author | Miguel Jacq <mig@mig5.net> | 2018-10-01 18:42:53 +1000 |
---|---|---|
committer | Miguel Jacq <mig@mig5.net> | 2018-10-01 18:42:53 +1000 |
commit | 3f32db2ccac6007255bff5eb0afad4fe11582389 (patch) | |
tree | 9a15592a5a61332a8cd913ad35241d568c462f38 /onionshare_gui | |
parent | f653e8cc04f09427afb219a82dbf7cf33090d45a (diff) | |
download | onionshare-3f32db2ccac6007255bff5eb0afad4fe11582389.tar.gz onionshare-3f32db2ccac6007255bff5eb0afad4fe11582389.zip |
Fix logic for handling an upload still in progress when timer runs out. Show thankyou page for last uploader post-timer expiry
Diffstat (limited to 'onionshare_gui')
-rw-r--r-- | onionshare_gui/receive_mode/__init__.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/onionshare_gui/receive_mode/__init__.py b/onionshare_gui/receive_mode/__init__.py index faa65ffe..c10622e4 100644 --- a/onionshare_gui/receive_mode/__init__.py +++ b/onionshare_gui/receive_mode/__init__.py @@ -51,6 +51,7 @@ class ReceiveMode(Mode): self.uploads_in_progress = 0 self.uploads_completed = 0 self.new_upload = False # For scrolling to the bottom of the uploads list + self.can_stop_server = False # for communicating to the auto-stop timer # Information about share, and show uploads button self.info_in_progress_uploads_count = QtWidgets.QLabel() @@ -93,7 +94,7 @@ class ReceiveMode(Mode): The shutdown timer expired, should we stop the server? Returns a bool """ # If there were no attempts to upload files, or all uploads are done, we can stop - if self.web.receive_mode.upload_count == 0 or not self.web.receive_mode.uploads_in_progress: + if self.web.receive_mode.upload_count == 0 or self.can_stop_server: self.server_status.stop_server() self.server_status_label.setText(strings._('close_on_timeout', True)) return True @@ -110,7 +111,9 @@ class ReceiveMode(Mode): Starting the server. """ # Reset web counters + self.can_stop_server = False self.web.receive_mode.upload_count = 0 + self.web.receive_mode.can_upload = True self.web.error404_count = 0 # Hide and reset the uploads if we have previously shared @@ -144,6 +147,7 @@ class ReceiveMode(Mode): self.uploads.add(event["data"]["id"], event["data"]["content_length"]) self.uploads_in_progress += 1 self.update_uploads_in_progress() + self.can_stop_server = False self.system_tray.showMessage(strings._('systray_upload_started_title', True), strings._('systray_upload_started_message', True)) @@ -177,6 +181,8 @@ class ReceiveMode(Mode): # Update the 'in progress uploads' info self.uploads_in_progress -= 1 self.update_uploads_in_progress() + if self.uploads_in_progress == 0: + self.can_stop_server = True def on_reload_settings(self): """ |