commit ff647c79fda23a04eca582203e542ea0ab409a0c
parent 57e7eb2ff9acb90ca1dbf4cb5e4fa56ec1e8c64d
Author: ThomasV <thomasv1@gmx.de>
Date: Sun, 10 Nov 2013 02:55:33 -0800
Merge pull request #374 from nolith/master
allow to connect to one server only
Diffstat:
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/electrum b/electrum
@@ -85,6 +85,7 @@ def arg_parser():
parser.add_option("-u", "--usb", dest="bitkey", action="store_true", help="Turn on support for hardware wallets (EXPERIMENTAL)")
parser.add_option("-G", "--gap", dest="gap_limit", default=None, help="gap limit")
parser.add_option("-W", "--password", dest="password", default=None, help="set password for usage with commands (currently only implemented for create command, do not use it for longrunning gui session since the password is visible in /proc)")
+ parser.add_option("-1", "--oneserver", action="store_true", dest="oneserver", default=False, help="connect to one server only")
return parser
def print_help(parser):
diff --git a/lib/network.py b/lib/network.py
@@ -22,7 +22,6 @@ DEFAULT_SERVERS = {
}
-NUM_SERVERS = 8
def filter_protocol(servers, p):
@@ -45,6 +44,7 @@ class Network(threading.Thread):
self.daemon = True
self.config = SimpleConfig(config) if type(config) == type({}) else config
self.lock = threading.Lock()
+ self.num_server = 8 if not self.config.get('oneserver') else 0
self.blockchain = Blockchain(self.config, self)
self.interfaces = {}
self.queue = Queue.Queue()
@@ -154,7 +154,7 @@ class Network(threading.Thread):
self.start_interface(self.default_server)
self.interface = self.interfaces[self.default_server]
- for i in range(NUM_SERVERS):
+ for i in range(self.num_server):
self.start_random_interface()
if not self.interface:
@@ -282,7 +282,7 @@ class Network(threading.Thread):
try:
i = self.queue.get(timeout = 30 if self.interfaces else 3)
except Queue.Empty:
- if len(self.interfaces) < NUM_SERVERS:
+ if len(self.interfaces) < self.num_server:
self.start_random_interface()
continue