fix(network): better disconnect handler
This commit is contained in:
parent
5ae5821929
commit
c06725aa69
|
@ -605,14 +605,15 @@ int waybar::modules::Network::handleEvents(struct nl_msg *msg, void *data) {
|
||||||
char ifname[IF_NAMESIZE];
|
char ifname[IF_NAMESIZE];
|
||||||
if_indextoname(ifi->ifi_index, ifname);
|
if_indextoname(ifi->ifi_index, ifname);
|
||||||
// Check for valid interface
|
// Check for valid interface
|
||||||
if (net->checkInterface(ifi, ifname)) {
|
if ((net->ifid_ == -1 || ifi->ifi_index != net->ifid_) && net->checkInterface(ifi, ifname)) {
|
||||||
net->ifname_ = ifname;
|
net->ifname_ = ifname;
|
||||||
net->ifid_ = ifi->ifi_index;
|
net->ifid_ = ifi->ifi_index;
|
||||||
// Get Iface and WIFI info
|
// Get Iface and WIFI info
|
||||||
net->getInterfaceAddress();
|
net->getInterfaceAddress();
|
||||||
net->thread_timer_.wake_up();
|
net->thread_timer_.wake_up();
|
||||||
return NL_OK;
|
return NL_OK;
|
||||||
} else if (ifi->ifi_index == net->ifid_ && !(ifi->ifi_flags & IFF_RUNNING)) {
|
} else if (ifi->ifi_index == net->ifid_ && (!(ifi->ifi_flags & IFF_RUNNING) ||
|
||||||
|
!(ifi->ifi_flags & IFF_UP) || !net->checkInterface(ifi, ifname))) {
|
||||||
net->clearIface();
|
net->clearIface();
|
||||||
// Check for a new interface and get info
|
// Check for a new interface and get info
|
||||||
net->checkNewInterface(ifi);
|
net->checkNewInterface(ifi);
|
||||||
|
|
Loading…
Reference in New Issue