metageek-llc / inSSIDer-2

inSSIDer 2 Wi-Fi Scanner
www.metageek.net
119 stars 60 forks source link

Inssider 2.1.1.1386 creates 2 scan threads when there is just 1 adaptor #68

Open jgoff opened 12 years ago

jgoff commented 12 years ago

This seems relatively harmless but unlikely to be intentional. If the inssider host has just one wireless NIC, then two scan threads are created,

first one via program.cs:

            NetworkInterface netInterface = InterfaceManager.Instance.LastInterface;
            if (netInterface != null)
            {
                Debug.WriteLine("We have a last interface, start scanning with it.");
                //Set the interface
                scanner.Interface = netInterface;
                if (Settings.Default.scanLastEnabled)
                    scanner.StartScanning();
            }

and the second via Initialize in NetworkInterfaceSelector.cs

            //If we are not on XP and only have 1 interface, start scanning
            if (!Utilities.IsXp() && InterfaceManager.Instance.Interfaces.Length == 1)
            {
                StartScan();
            }

seems reasonable to just add a check for IsScanning as below:

        public bool Start(NetworkInterface networkInterface)
        {
            Exception error;

            if (IsScanning)
                  return true;
StephenMP commented 12 years ago

This can be "fixed" by just removing the first StartScanning() call in the Program.cs class as a scan thread will be created in NetworkInterfaceSelector.cs class when it finds the the NIC