sanitize server in interface.py (fix bug #309)

This commit is contained in:
ThomasV 2013-10-08 19:52:17 +02:00
parent 367b11681b
commit 83e699c314
1 changed files with 9 additions and 3 deletions

View File

@ -109,9 +109,13 @@ class Interface(threading.Thread):
# parse server
self.server = server
host, port, protocol = self.server.split(':')
port = int(port)
try:
host, port, protocol = self.server.split(':')
port = int(port)
except:
self.server = None
return
if protocol not in 'ghst':
raise BaseException('Unknown protocol: %s'%protocol)
@ -539,6 +543,8 @@ class Interface(threading.Thread):
def start(self, queue = None, wait = False):
if not self.server:
return
self.queue = queue if queue else Queue.Queue()
threading.Thread.start(self)
if wait: