1
0

handle network.interface being None when network is disconnected

This commit is contained in:
ThomasV
2013-10-04 19:27:50 +02:00
parent ac956a97cb
commit a38298c5ee
4 changed files with 20 additions and 11 deletions

View File

@@ -166,6 +166,11 @@ class Network(threading.Thread):
return self.interface.is_connected
def wait_until_connected(self):
while not self.interface:
time.sleep(1)
self.interface.connect_event.wait()
def set_proxy(self, proxy):
self.proxy = proxy
@@ -175,7 +180,9 @@ class Network(threading.Thread):
return
# stop the interface in order to terminate subscriptions
self.interface.stop()
if self.interface:
self.interface.stop()
# notify gui
self.trigger_callback('disconnecting')
# start interface