[kismac] [binaervarianz] r108 - in KisMACng: . Sources/WaveDrivers

  • From: svn@xxxxxxxxxxxxxxxx
  • To: kismac@xxxxxxxxxxxxx
  • Date: Fri, 17 Mar 2006 05:48:18 +0100

Author: gkruse
Date: 2006-03-17 05:48:18 +0100 (Fri, 17 Mar 2006)
New Revision: 108

Modified:
   KisMACng/CHANGES
   KisMACng/Sources/WaveDrivers/WaveDriver.m
Log:
Fixed #35, #36 and #54.  When not hopping, still set channel in hopping method. 
 This avoids a nasty race condition.


M    Sources/WaveDrivers/WaveDriver.m
M    CHANGES


Modified: KisMACng/CHANGES
===================================================================
--- KisMACng/CHANGES    2006-03-16 20:57:10 UTC (rev 107)
+++ KisMACng/CHANGES    2006-03-17 04:48:18 UTC (rev 108)
@@ -1,3 +1,5 @@
+R108: - Fixed #35, #36 and #54.  When not hopping, still set channel in 
hopping method.  This avoids a nasty race condition.
+
 R107: - Fixed #51 - deleting a net causes kismac to crash
          - Fixed #9 - used Geoffs patch to fix GPS update...
 

Modified: KisMACng/Sources/WaveDrivers/WaveDriver.m
===================================================================
--- KisMACng/Sources/WaveDrivers/WaveDriver.m   2006-03-16 20:57:10 UTC (rev 
107)
+++ KisMACng/Sources/WaveDrivers/WaveDriver.m   2006-03-17 04:48:18 UTC (rev 
108)
@@ -158,24 +158,7 @@
     }
     [sets setObject:a forKey:@"ActiveDrivers"];
     [a release];
-    
-    if (!_hop) {
-        if (ch == 0) ch = 1;
-        _firstChannel = ch;
-        if ([self allowsChannelHopping]) {
-            for (i = 0; i < 20; i++) { //try again if the card does not want 
to react
-                [self setChannel:ch];
-                ch = [self getChannelUnCached];
-                if (ch==_firstChannel) break;
-            }
-            if (i == 20) {
-                [self stopCapture];
-                [self startCapture: _firstChannel];
-            }
-        }
-        _currentChannel = _firstChannel;
-    }
-    
+
     return YES;
 }
 
@@ -220,9 +203,29 @@
 }
 
 - (void)hopToNextChannel {
-    int channel, i;
-
-    if (!_hop) return;
+    int channel = _currentChannel+1, i;
+   
+    if (!_hop) {
+        while (_useChannel[channel - 1] == NO) {
+            channel = (channel % 14) + 1;
+            if (channel == _currentChannel) break; //just make sure it ends
+        }
+         _currentChannel = [self getChannelUnCached];
+         if (_currentChannel == channel) {
+             return;
+         } else {
+             for(i=0; i < 20; i++) {
+                 [self setChannel: channel];
+                 _currentChannel = [self getChannelUnCached];
+                 if (_currentChannel == channel) break;
+             }
+             if (i == 20) {
+                 [self stopCapture];
+                 [self startCapture: channel];
+             }
+         }
+         return;
+    }
     
     if (_autoAdjustTimer && (_packets!=0)) {
         if (_autoRepeat<1) {


Other related posts:

  • » [kismac] [binaervarianz] r108 - in KisMACng: . Sources/WaveDrivers