sanitize server and protocol
This commit is contained in:
parent
48838be816
commit
761871b900
|
@ -96,10 +96,19 @@ class Network(threading.Thread):
|
|||
self.interfaces = {}
|
||||
self.queue = Queue.Queue()
|
||||
self.protocol = self.config.get('protocol','s')
|
||||
# sanitize protocol
|
||||
if self.protocol not in 'sght': self.protocol = 's'
|
||||
self.running = False
|
||||
|
||||
# Server for addresses and transactions
|
||||
self.default_server = self.config.get('server')
|
||||
# Sanitize default server
|
||||
try:
|
||||
host, port, protocol = self.default_server.split(':')
|
||||
assert protocol == self.protocol
|
||||
int(port)
|
||||
except:
|
||||
self.default_server = None
|
||||
if not self.default_server:
|
||||
self.default_server = pick_random_server(self.protocol)
|
||||
|
||||
|
|
Loading…
Reference in New Issue