Skip to content

feat(network): detect IWD connection state in known_connections#827

Open
dacrab wants to merge 1 commit into
MalpenZibo:mainfrom
dacrab:feat/iwd-connection-state
Open

feat(network): detect IWD connection state in known_connections#827
dacrab wants to merge 1 commit into
MalpenZibo:mainfrom
dacrab:feat/iwd-connection-state

Conversation

@dacrab

@dacrab dacrab commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Replaces the TODO placeholders for state and working in IWD's known_connections by querying each station's State and ConnectedNetwork properties to determine the actual connection state.

Comment thread src/services/network/iwd_dbus/mod.rs Outdated

// Determine connection state by checking if this network is connected
let station = self
.stations()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a performance concern self.stations() is called inside the loop.
stations() is list_proxies!(...) over the zbus object manager. Every iteration re-enumerates station proxies.

move the lookup out of the loop:

let stations: HashMap<_, _> = self
    .stations()
    .await?
    .into_iter()
    .map(|s| (s.inner().path().clone(), s))
    .collect();

for (n, signal_strength) in nets {
    ...
    let station = stations.get(&device_path);
    ...
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — moved the stations() call out of the loop and into a HashMap lookup before iterating. Pushed in 194ba7c.

@MalpenZibo MalpenZibo left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me it's ok! Let's wait @romanstingler

@MalpenZibo MalpenZibo requested a review from romanstingler June 26, 2026 09:48
@dacrab dacrab force-pushed the feat/iwd-connection-state branch from 194ba7c to 8b6cf0c Compare June 28, 2026 17:31
@dacrab

dacrab commented Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

Rebased on latest main and resolved merge conflict (upstream renamed AccessPointAccessPointData). @romanstingler your concern about stations() being called in the loop was already addressed in the previous commit — it now uses a single HashMap lookup.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants