-
Notifications
You must be signed in to change notification settings - Fork 1
fix: tunnel toggle spinner, stale proxy state, and Linux AppImage crash #144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7380453
fix: don't overwrite tunnel status on toggle
zachsmith1 8761c9b
fix: remove stale proxy state on tunnel recreate
zachsmith1 ee2f13b
chore: apply cargo fmt
zachsmith1 a365db2
Merge remote-tracking branch 'origin/main' into fix/tunnel-toggle-spi…
zachsmith1 30b2ae7
fix: remove n0des diagnostics, net diagnostics now via iroh-services
zachsmith1 c80b58a
chore: apply cargo fmt
zachsmith1 7e370f6
fix: bundle libayatana-indicator3 in AppImage
zachsmith1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -249,6 +249,10 @@ impl TunnelService { | |||||
| }); | ||||||
| } | ||||||
| if !self.publish_tickets { | ||||||
| let current_ids: std::collections::HashSet<&str> = | ||||||
| tunnels.iter().map(|t| t.id.as_str()).collect(); | ||||||
|
|
||||||
| // Sync state for each tunnel returned by the server. | ||||||
| for tunnel in &tunnels { | ||||||
| if let Ok(proxy_state) = proxy_state_from_summary( | ||||||
| &tunnel.id, | ||||||
|
|
@@ -260,6 +264,37 @@ impl TunnelService { | |||||
| warn!(tunnel_id = %tunnel.id, "Failed to store proxy state: {err:#}"); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| // Remove stale local entries that share host:port with a current tunnel | ||||||
| // but have a different resource_id. These accumulate when a tunnel is | ||||||
| // deleted and recreated with the same endpoint (new ID). Without this, | ||||||
| // the stale enabled entry causes tcp_proxy_exists to return true even | ||||||
| // when the current tunnel is disabled, allowing traffic through. | ||||||
| // | ||||||
| // Scoped to same-endpoint matches so we don't touch entries belonging | ||||||
| // to other projects with different endpoints. | ||||||
| for tunnel in &tunnels { | ||||||
| let Ok(data) = TcpProxyData::from_host_port_str(&strip_scheme(&tunnel.endpoint)) | ||||||
| else { | ||||||
| continue; | ||||||
| }; | ||||||
| let stale_ids: Vec<String> = self | ||||||
| .listen | ||||||
| .proxies() | ||||||
| .into_iter() | ||||||
| .filter(|p| { | ||||||
| !current_ids.contains(p.id()) | ||||||
| && p.info.service().host == data.host | ||||||
| && p.info.service().port == data.port | ||||||
| }) | ||||||
| .map(|p| p.id().to_string()) | ||||||
| .collect(); | ||||||
| for id in stale_ids { | ||||||
| if let Err(err) = self.listen.remove_proxy_state(&id).await { | ||||||
| warn!(tunnel_id = %id, "Failed to remove stale proxy state: {err:#}"); | ||||||
|
||||||
| warn!(tunnel_id = %id, "Failed to remove stale proxy state: {err:#}"); | |
| warn!(proxy_id = %id, "Failed to remove stale proxy state: {err:#}"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.listen.proxies()clones the full proxy list (viato_vec()) and is called once per tunnel, making this stale-scan O(tunnels × proxies) with repeated allocations. Consider pullinglet proxies = self.listen.proxies();out of the loop and computing all stale IDs in a single pass (e.g., precompute a set of current endpoints and collect matching stale IDs into aHashSetbefore removing).