mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-13 16:29:31 -05:00
Rename close_after_seconds class to ShutdownTimer
This commit is contained in:
parent
2e6538b7f8
commit
49e352d131
@ -225,7 +225,7 @@ def dir_size(start_path):
|
|||||||
return total_size
|
return total_size
|
||||||
|
|
||||||
|
|
||||||
class close_after_seconds(threading.Thread):
|
class ShutdownTimer(threading.Thread):
|
||||||
"""
|
"""
|
||||||
Background thread sleeps t hours and returns.
|
Background thread sleeps t hours and returns.
|
||||||
"""
|
"""
|
||||||
|
@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
import os, shutil
|
import os, shutil
|
||||||
|
|
||||||
from . import common, strings
|
from . import common, strings
|
||||||
|
from .common import ShutdownTimer
|
||||||
|
|
||||||
class OnionShare(object):
|
class OnionShare(object):
|
||||||
"""
|
"""
|
||||||
@ -74,7 +75,7 @@ class OnionShare(object):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if self.shutdown_timeout > 0:
|
if self.shutdown_timeout > 0:
|
||||||
self.shutdown_timer = common.close_after_seconds(self.shutdown_timeout)
|
self.shutdown_timer = ShutdownTimer(self.shutdown_timeout)
|
||||||
|
|
||||||
self.onion_host = self.onion.start_onion_service(self.port)
|
self.onion_host = self.onion.start_onion_service(self.port)
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ import queue
|
|||||||
from PyQt5 import QtCore, QtWidgets, QtGui
|
from PyQt5 import QtCore, QtWidgets, QtGui
|
||||||
|
|
||||||
from onionshare import strings, common
|
from onionshare import strings, common
|
||||||
|
from onionshare.common import ShutdownTimer
|
||||||
from onionshare.settings import Settings
|
from onionshare.settings import Settings
|
||||||
from onionshare.onion import *
|
from onionshare.onion import *
|
||||||
|
|
||||||
@ -468,7 +469,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||||||
self.timeout = now.secsTo(self.server_status.timeout)
|
self.timeout = now.secsTo(self.server_status.timeout)
|
||||||
# Set the shutdown timeout value
|
# Set the shutdown timeout value
|
||||||
if self.timeout > 0:
|
if self.timeout > 0:
|
||||||
self.app.shutdown_timer = common.close_after_seconds(self.timeout)
|
self.app.shutdown_timer = ShutdownTimer(self.timeout)
|
||||||
self.app.shutdown_timer.start()
|
self.app.shutdown_timer.start()
|
||||||
# The timeout has actually already passed since the user clicked Start. Probably the Onion service took too long to start.
|
# The timeout has actually already passed since the user clicked Start. Probably the Onion service took too long to start.
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user