1
0

Trezor: session timeout improvements

Move session timeout from wallet to config
Prevent timeouts whenever a device operation is in progress
Move timeout job from each plugin to device manager
This commit is contained in:
Neil Booth
2016-02-10 21:51:22 +09:00
parent 7fcc881dd4
commit 5f28834bb2
8 changed files with 73 additions and 82 deletions

View File

@@ -4,7 +4,7 @@ import threading
import os
from copy import deepcopy
from util import user_dir, print_error, print_msg, print_stderr
from util import user_dir, print_error, print_msg, print_stderr, PrintError
SYSTEM_CONFIG_PATH = "/etc/electrum.conf"
@@ -21,7 +21,7 @@ def set_config(c):
config = c
class SimpleConfig(object):
class SimpleConfig(PrintError):
"""
The SimpleConfig class is responsible for handling operations involving
configuration files.
@@ -168,6 +168,13 @@ class SimpleConfig(object):
recent.remove(filename)
self.set_key('recently_open', recent)
def set_session_timeout(self, seconds):
self.print_error("session timeout -> %d seconds" % seconds)
self.set_key('session_timeout', seconds)
def get_session_timeout(self):
return self.get('session_timeout', 300)
def read_system_config(path=SYSTEM_CONFIG_PATH):
"""Parse and return the system config settings in /etc/electrum.conf."""