electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 98cc9c53d1c05001380da57f43a6f5815632fbbc
parent a805afa900c1c135ed7b179f854077bb6c1c15c9
Author: ThomasV <thomasv@gitorious>
Date:   Thu,  2 Apr 2015 10:50:09 +0200

do not write config file from network class

Diffstat:
Mlib/network.py | 12+-----------
Mlib/network_proxy.py | 14++++++++++++--
2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/lib/network.py b/lib/network.py @@ -308,15 +308,6 @@ class Network(util.DaemonThread): def set_parameters(self, host, port, protocol, proxy, auto_connect): - proxy_str = serialize_proxy(proxy) - server_str = serialize_server(host, port, protocol) - self.config.set_key('auto_cycle', auto_connect, True) - self.config.set_key("proxy", proxy_str, True) - self.config.set_key("server", server_str, True) - # abort if changes were not allowed by config - if self.config.get('server') != server_str or self.config.get('proxy') != proxy_str: - return - if self.proxy != proxy or self.protocol != protocol: self.print_error('restarting network') for i in self.interfaces.values(): @@ -336,6 +327,7 @@ class Network(util.DaemonThread): if self.server_is_lagging(): self.stop_interface() else: + server_str = serialize_server(host, port, protocol) self.set_server(server_str) @@ -352,7 +344,6 @@ class Network(util.DaemonThread): server = interface.server self.print_error("switching to", server) self.interface = interface - self.config.set_key('server', server, False) self.default_server = server self.send_subscriptions() self.set_status('connected') @@ -378,7 +369,6 @@ class Network(util.DaemonThread): self.set_status('connecting') # start interface self.default_server = server - self.config.set_key("server", server, True) if server in self.interfaces.keys(): self.switch_to_interface( self.interfaces[server] ) diff --git a/lib/network_proxy.py b/lib/network_proxy.py @@ -30,6 +30,7 @@ from network import Network from util import print_error, print_stderr, parse_json from simple_config import SimpleConfig from daemon import NetworkServer +from network import serialize_proxy, serialize_server @@ -205,8 +206,17 @@ class NetworkProxy(util.DaemonThread): def get_parameters(self): return self.synchronous_get([('network.get_parameters', [])])[0] - def set_parameters(self, *args): - return self.synchronous_get([('network.set_parameters', args)])[0] + def set_parameters(self, host, port, protocol, proxy, auto_connect): + proxy_str = serialize_proxy(proxy) + server_str = serialize_server(host, port, protocol) + self.config.set_key('auto_cycle', auto_connect, True) + self.config.set_key("proxy", proxy_str, True) + self.config.set_key("server", server_str, True) + # abort if changes were not allowed by config + if self.config.get('server') != server_str or self.config.get('proxy') != proxy_str: + return + + return self.synchronous_get([('network.set_parameters', (host, port, protocol, proxy, auto_connect))])[0] def stop_daemon(self): return self.send([('daemon.stop',[])], None)