Skip to content

Commit

Permalink
fix(fallback): report interface down/up logic (#31)
Browse files Browse the repository at this point in the history
Reverse the logic when checking if a recorded interface still exists in the new list to avoid reporting all interfaces as down and then up in the same `resync()`.
  • Loading branch information
cafedetal authored Mar 30, 2023
1 parent 31c4780 commit fe2a2cd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.0.1]

### Fixed

- For all architectures running the fallback option (e.g. Android) reverse the logic when checking if a recorded interface still exists in the new list to avoid reporting all interfaces as down and then up in the same resync().
See [PR 31].

[PR 31]: https://github.com/mxinden/if-watch/pull/31

## [3.0.0]

### Changed
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "if-watch"
version = "3.0.0"
version = "3.0.1"
authors = ["David Craven <david@craven.ch>", "Parity Technologies Limited <admin@parity.io>"]
edition = "2021"
keywords = ["asynchronous", "routing"]
Expand Down
2 changes: 1 addition & 1 deletion src/fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl IfWatcher {
fn resync(&mut self) -> Result<()> {
let addrs = if_addrs::get_if_addrs()?;
for old_addr in self.addrs.clone() {
if addrs.iter().any(|addr| addr.ip() == old_addr.addr()) {
if !addrs.iter().any(|addr| addr.ip() == old_addr.addr()) {
self.addrs.remove(&old_addr);
self.queue.push_back(IfEvent::Down(old_addr));
}
Expand Down

0 comments on commit fe2a2cd

Please sign in to comment.