1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-29 01:42:33 +01:00

Moved StopWPA functions up to superclasses.

This commit is contained in:
Joe MacMahon
2012-01-29 04:05:16 +00:00
parent 0bf1a68353
commit b81941bd7e
2 changed files with 18 additions and 14 deletions

View File

@@ -518,6 +518,12 @@ class ConnectThread(threading.Thread):
finally:
self.lock.release()
@abortable
def stop_wpa(self, iface):
""" Stops wpa_supplicant. """
print 'Stopping wpa_supplicant'
iface.StopWPA()
@abortable
def put_iface_up(self, iface):
""" Bring up given interface. """
@@ -968,13 +974,6 @@ class WirelessConnectThread(ConnectThread):
self.abort_connection('association_failed')
else:
print 'not verifying'
@abortable
def stop_wpa(self, wiface):
""" Stops wpa_supplicant. """
print 'Stopping wpa_supplicant'
wiface.StopWPA()
@abortable
def generate_psk_and_authenticate(self, wiface):
@@ -1073,6 +1072,10 @@ class Wired(Controller):
def Disconnect(self):
Controller.Disconnect(self, 'wired', 'wired', 'wired')
self.StopWPA()
def StopWPA(self):
self.liface.StopWPA()
def DetectWiredInterface(self):
""" Attempts to automatically detect a wired interface. """
@@ -1143,6 +1146,7 @@ class WiredConnectThread(ConnectThread):
self.put_iface_down(liface)
self.release_dhcp_clients(liface)
self.reset_ip_addresses(liface)
self.stop_wpa(liface)
self.flush_routes(liface)
# Bring up interface.

View File

@@ -768,6 +768,13 @@ class BaseInterface(object):
print "Could not open %s, using ifconfig to determine status" % flags_file
return self._slow_is_up(ifconfig)
return bool(int(flags, 16) & 1)
@neediface(False)
def StopWPA(self):
""" Terminates wpa using wpa_cli"""
cmd = 'wpa_cli -i %s terminate' % self.iface
if self.verbose: print cmd
misc.Run(cmd)
def _slow_is_up(self, ifconfig=None):
@@ -1392,13 +1399,6 @@ class BaseWirelessInterface(BaseInterface):
print 'wpa_supplicant rescan forced...'
cmd = 'wpa_cli -i' + self.iface + ' scan'
misc.Run(cmd)
@neediface(False)
def StopWPA(self):
""" Terminates wpa using wpa_cli"""
cmd = 'wpa_cli -i %s terminate' % self.iface
if self.verbose: print cmd
misc.Run(cmd)
@neediface("")
def GetBSSID(self, iwconfig=None):