mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
network: Rework address lookup to use only events
In order to get the IP address of an interface, we can get the information out of NEWADDR events without needed to call getifaddrs(). And when now events are expected, we can requests a dump of all addresses and handle addresses changes the same way via handleEvents() only.
This commit is contained in:
@ -2,7 +2,6 @@
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <fmt/format.h>
|
||||
#include <ifaddrs.h>
|
||||
#include <linux/nl80211.h>
|
||||
#include <net/if.h>
|
||||
#include <netlink/genl/ctrl.h>
|
||||
@ -37,7 +36,6 @@ class Network : public ALabel {
|
||||
void createInfoSocket();
|
||||
void createEventSocket();
|
||||
int getExternalInterface(int skip_idx = -1) const;
|
||||
void getInterfaceAddress();
|
||||
int netlinkRequest(void*, uint32_t, uint32_t groups = 0) const;
|
||||
int netlinkResponse(void*, uint32_t, uint32_t groups = 0) const;
|
||||
void parseEssid(struct nlattr**);
|
||||
@ -63,6 +61,7 @@ class Network : public ALabel {
|
||||
std::mutex mutex_;
|
||||
|
||||
bool want_link_dump_;
|
||||
bool want_addr_dump_;
|
||||
bool dump_in_progress_;
|
||||
|
||||
unsigned long long bandwidth_down_total_;
|
||||
|
Reference in New Issue
Block a user