friedrith / node-wifi

📶 NodeJS tool to manage wifi (connections, scans)
MIT License
396 stars 160 forks source link

Linux: getCurrentConnections returns an array with the same element doubled #140

Open zeved opened 3 years ago

zeved commented 3 years ago

Sometimes the getCurrentConnections returns the same array twice inside the array:

[
  {
    iface: 'wlan0',
    ssid: 'Unknown SSID',
    bssid: '12:34:56:78:90:AA',
    mac: '12:34:56:78:90:AA',
    mode: 'Infra',
    channel: 36,
    frequency: 5180,
    signal_level: -50,
    quality: 100,
    security: 'WPA2',
    security_flags: { wpa: '(none)', rsn: 'pair_ccmp group_ccmp psk' }
  },
  {
    iface: 'wlan0',
    ssid: 'Unknown SSID',
    bssid: '12:34:56:78:90:AA',
    mac: '12:34:56:78:90:AA',
    mode: 'Infra',
    channel: 36,
    frequency: 5180,
    signal_level: -61.5,
    quality: 77,
    security: 'WPA2',
    security_flags: { wpa: '(none)', rsn: 'pair_ccmp group_ccmp psk' }
  }
]

Expected Behavior

The resulting array should not contain the same network connection twice

Current Behavior

The getCurrentConnections function returns the same network twice

Affected features

Steps to Reproduce (for bugs)

Call the getCurrentConnections function repeatedly and analyze the result

Context

I am using your package in an NodeJS server for an Electron app and I need to poll the status of the Wifi connection every 5 seconds.

Your Environment

P.S.: I created two separate issues because even they are related (the same function) they are two different issues (or at least so they seem)

Edit: 'Unknown SSID' is the actual name of my Wifi, no error there :grin: