1
0
mirror of https://github.com/gryf/wicd.git synced 2026-01-08 06:44:20 +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: finally:
self.lock.release() self.lock.release()
@abortable
def stop_wpa(self, iface):
""" Stops wpa_supplicant. """
print 'Stopping wpa_supplicant'
iface.StopWPA()
@abortable @abortable
def put_iface_up(self, iface): def put_iface_up(self, iface):
""" Bring up given interface. """ """ Bring up given interface. """
@@ -969,13 +975,6 @@ class WirelessConnectThread(ConnectThread):
else: else:
print 'not verifying' print 'not verifying'
@abortable
def stop_wpa(self, wiface):
""" Stops wpa_supplicant. """
print 'Stopping wpa_supplicant'
wiface.StopWPA()
@abortable @abortable
def generate_psk_and_authenticate(self, wiface): def generate_psk_and_authenticate(self, wiface):
""" Generates a PSK and authenticates if necessary. """ Generates a PSK and authenticates if necessary.
@@ -1073,6 +1072,10 @@ class Wired(Controller):
def Disconnect(self): def Disconnect(self):
Controller.Disconnect(self, 'wired', 'wired', 'wired') Controller.Disconnect(self, 'wired', 'wired', 'wired')
self.StopWPA()
def StopWPA(self):
self.liface.StopWPA()
def DetectWiredInterface(self): def DetectWiredInterface(self):
""" Attempts to automatically detect a wired interface. """ """ Attempts to automatically detect a wired interface. """
@@ -1143,6 +1146,7 @@ class WiredConnectThread(ConnectThread):
self.put_iface_down(liface) self.put_iface_down(liface)
self.release_dhcp_clients(liface) self.release_dhcp_clients(liface)
self.reset_ip_addresses(liface) self.reset_ip_addresses(liface)
self.stop_wpa(liface)
self.flush_routes(liface) self.flush_routes(liface)
# Bring up interface. # Bring up interface.

View File

@@ -769,6 +769,13 @@ class BaseInterface(object):
return self._slow_is_up(ifconfig) return self._slow_is_up(ifconfig)
return bool(int(flags, 16) & 1) 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): def _slow_is_up(self, ifconfig=None):
""" Determine if an interface is up using ifconfig. """ """ Determine if an interface is up using ifconfig. """
@@ -1393,13 +1400,6 @@ class BaseWirelessInterface(BaseInterface):
cmd = 'wpa_cli -i' + self.iface + ' scan' cmd = 'wpa_cli -i' + self.iface + ' scan'
misc.Run(cmd) 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("") @neediface("")
def GetBSSID(self, iwconfig=None): def GetBSSID(self, iwconfig=None):
""" Get the MAC address for the interface. """ """ Get the MAC address for the interface. """