Browse Source

Merge pull request #1230 from kyuupichan/switch-random-if

Remove interfaces in one place only
283
ThomasV 10 years ago
parent
commit
0b201d98ab
  1. 11
      lib/network.py

11
lib/network.py

@ -354,13 +354,9 @@ class Network(util.DaemonThread):
def switch_to_random_interface(self):
while self.interfaces:
i = random.choice(self.interfaces.values())
if i.is_connected():
self.switch_to_interface(i.server)
break
else:
self.remove_interface(i)
if self.interfaces:
server = random.choice(self.interfaces.keys())
self.switch_to_interface(server)
def switch_to_interface(self, server):
'''Switch to server as our interface, it must be in self.interfaces'''
@ -508,7 +504,6 @@ class Network(util.DaemonThread):
# main interface
if not self.is_connected():
if self.config.get('auto_cycle'):
if self.interfaces:
self.switch_to_random_interface()
else:
if self.default_server in self.interfaces.keys():

Loading…
Cancel
Save