Network: Add a BNetworkDevice::GetNetworks() method and use it in the GUI.

The GetNextNetwork() method is really inefficient: it fetches all the
networks at once from the kernel every single time and then winds
up returning only one of them. In parts of the GUI that iterate over
all networks more than once per refresh (sometimes within a loop, even!)
this was often a noticeable lag on the GUI, especially with OpenBSD
drivers which have extra overhead to do struct translation in the
ioctl handler.

Now, we have a way to fetch all scan results at once and just iterate
over them as many times as we need, and this is what NetworkStatus
and Network preferences now do, saving lots of time and effort.
This commit is contained in:
Augustin Cavalier
2022-10-25 23:34:42 -04:00
parent 65c155bede
commit b2c77ad27a
4 changed files with 86 additions and 16 deletions
+2
View File
@@ -114,6 +114,8 @@ public:
status_t GetNextNetwork(uint32& cookie,
wireless_network& network);
status_t GetNetworks(wireless_network*& networks,
uint32& count);
status_t GetNetwork(const char* name,
wireless_network& network);
status_t GetNetwork(const BNetworkAddress& address,