From 6bad6d645208c7fa8960bcac6667eb78f63672cf Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 22 Aug 2005 22:37:38 +0000 Subject: [PATCH] 2005-08-22 Dan Williams Noticed by Bill Moss * src/NetworkManagerDevice.c - (nm_device_wireless_scan): fix scan timeout, we were waiting way too long for scans to complete git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@897 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 7 +++++++ src/NetworkManagerDevice.c | 8 +++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c656925d28..62dcac3eca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-08-22 Dan Williams + + Noticed by Bill Moss + * src/NetworkManagerDevice.c + - (nm_device_wireless_scan): fix scan timeout, we were + waiting way too long for scans to complete + 2005-08-22 Dan Williams Patch from j@bootlab.org: diff --git a/src/NetworkManagerDevice.c b/src/NetworkManagerDevice.c index 84c894d4b3..234d680c59 100644 --- a/src/NetworkManagerDevice.c +++ b/src/NetworkManagerDevice.c @@ -4001,7 +4001,10 @@ static gboolean nm_device_wireless_scan (gpointer user_data) NMNetworkMode orig_mode = NETWORK_MODE_INFRA; double orig_freq = 0; int orig_rate = 0; - const int max_wait = G_USEC_PER_SEC * nm_device_get_association_pause_value (dev) /2; + const int interval = 20; + const int assoc_pause = nm_device_get_association_pause_value (dev); + const int delay = (G_USEC_PER_SEC * assoc_pause) / interval; + const int max_tries = assoc_pause * interval; nm_completion_args args; orig_mode = nm_device_get_mode (dev); @@ -4023,8 +4026,7 @@ static gboolean nm_device_wireless_scan (gpointer user_data) args[1] = &err; args[2] = sk; args[3] = scan_results; - nm_wait_for_completion(max_wait, max_wait/20, - nm_completion_scan_has_results, NULL, args); + nm_wait_for_completion (max_tries, delay, nm_completion_scan_has_results, NULL, args); nm_device_set_mode (dev, orig_mode); /* Only set frequency if ad-hoc mode */