1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-19 20:38:00 +01:00

Improved the authentication validation code. Instead of sleeping for an abitrary amount of time, then checking if authentication succeeded, it now repeatedly checks for a longer set amount of time. This way it is less likely to fail because it didn't wait long enough, but will usually finish faster.

This commit is contained in:
imdano
2008-03-01 00:59:52 +00:00
parent 08b9f9f993
commit bcb46c1f12
2 changed files with 28 additions and 32 deletions

View File

@@ -483,7 +483,6 @@ class WirelessConnectThread(ConnectThread):
self.SetStatus('generating_wpa_config')
print 'Attempting to authenticate...'
wiface.Authenticate(self.network)
auth_time = time.time()
if self.should_die:
wiface.Up()
@@ -512,19 +511,9 @@ class WirelessConnectThread(ConnectThread):
self.network['bssid'])
if self.network.get('enctype') is not None:
# Allow some time for wpa_supplicant to associate.
# Hopefully 3 sec is enough. If it proves to be inconsistent,
# we might have to try to monitor wpa_supplicant more closely,
# so we can tell exactly when it fails/succeeds.
self.SetStatus('validating_authentication')
elapsed = time.time() - auth_time
if elapsed < 3 and elapsed >= 0:
if self.debug:
print 'sleeping for ' + str(3 - elapsed)
time.sleep(3 - elapsed)
# Make sure wpa_supplicant was able to associate.
if not wiface.ValidateAuthentication():
if not wiface.ValidateAuthentication(time.time()):
self.connect_aborted('bad_pass')
return