Skip to content

prune network interfaces that no longer exist - #577

Open
ThorOdinson246 wants to merge 1 commit into
corecoding:mainfrom
ThorOdinson246:fix-557-minimal
Open

prune network interfaces that no longer exist#577
ThorOdinson246 wants to merge 1 commit into
corecoding:mainfrom
ThorOdinson246:fix-557-minimal

Conversation

@ThorOdinson246

Copy link
Copy Markdown

Fixes #557.

The problem

Vitals never forgets a network interface. Once one disappears from /sys/class/net,
nothing removes it from _history, _networkSpeeds or _networkSpeedOffset.

Two effects:

  • The menu keeps listing interfaces that no longer exist.
  • Device rx/tx sums every entry in _networkSpeeds, so a dead interface's last speed keeps being counted.

The fix

When _queryNetwork sees an interface disappear, it reports 'destroy' for that sensor
through the normal callback. The same mechanism is used by a disabled sensor to report 'disabled'. extension.js handles it next to the existing 'disabled' check and drops the menu item, the hot item and the stored history.

A few notes on the choices, happy to change any of them:

  • Nothing is written to GSettings. hot-sensors is left alone, so a pinned interface comes
    back if it reappears rather than being silently unpinned.
  • Removal triggers on the interface being gone from /sys/class/net, not on it being down. So,
    a down interface keeps its directory, so toggling wifi does nothing here. I avoided matching
    on veth*/br-* names since that would hide real docker bridges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Seems to remember every single network adapter, including ephemeral ones

1 participant