Skip to content
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

Feat: Closing an existing port forward #165

Merged
merged 19 commits into from
Sep 10, 2024

Conversation

jaywonchung
Copy link
Contributor

@jaywonchung jaywonchung commented Sep 10, 2024

I implemented port forwarding cancellation for the process mux session implementation.

CC. @NobodyXu

Closes #110

@jonhoo
Copy link
Collaborator

jonhoo commented Sep 10, 2024

This change is Reviewable

@codecov-commenter
Copy link

codecov-commenter commented Sep 10, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 84.74576% with 9 lines in your changes missing coverage. Please review.

Project coverage is 81.56%. Comparing base (bacc76d) to head (03fb7bd).
Report is 15 commits behind head on master.

Files with missing lines Patch % Lines
src/process_impl/session.rs 68.96% 9 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
Files with missing lines Coverage Δ
src/native_mux_impl/session.rs 95.60% <100.00%> (+1.00%) ⬆️
src/session.rs 81.10% <100.00%> (+3.90%) ⬆️
src/process_impl/session.rs 84.54% <68.96%> (-2.47%) ⬇️

... and 12 files with indirect coverage changes

@jaywonchung jaywonchung changed the title Feat: Port forwarding cancellation for "process-mux" Feat: Closing an existing port forward Sep 10, 2024
@NobodyXu NobodyXu marked this pull request as ready for review September 10, 2024 14:15
@NobodyXu
Copy link
Member

NobodyXu commented Sep 10, 2024

Sorry I was approving the workflow for your PR, but accidentally hit the "ready for review" button

@jaywonchung
Copy link
Contributor Author

No worries. But actually good timing you're here -- I'm stuck with testing remote forwarding closure.

Calling read() on the socket will actually return a single Line Feed (ascii 10) character. Doing UnixStream::connect will actually connect to the socket without any problem, perhaps because there is one more character left to read. I suspected that the echo that is used to generate test data from the remote side is appending an extra newline so tried removing the final \n from the payload, and now read() hangs -- probably because there is not more data left to read and the socket blocks. The code path for local and remote forwarding are exactly the same and I actually verified local forwarding & cancellation working very well in my actual use case. Any ideas?

@jaywonchung
Copy link
Contributor Author

Alright, on my local setup where I do remote forwarding and manually cancel, I found a way. There's one CI failing (With dependencies at minimal versions) but I presume that's because this new API is not part of the latest release of openssh.

Copy link
Member

@NobodyXu NobodyXu left a comment

Choose a reason for hiding this comment

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

Sorry I was on another project and didn't check my github

You need to update Cargo.toml, to use latest openssh-mux-client, otherwise that CI would pick the lowest version fitting allowed by version requirements.

@jaywonchung
Copy link
Contributor Author

Cool, now With dependencies at minimal versions passes as well!

@NobodyXu NobodyXu enabled auto-merge (squash) September 10, 2024 14:57
@NobodyXu NobodyXu disabled auto-merge September 10, 2024 14:57
Copy link
Member

@NobodyXu NobodyXu left a comment

Choose a reason for hiding this comment

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

Thank you!

@NobodyXu NobodyXu merged commit a3fc969 into openssh-rust:master Sep 10, 2024
12 checks passed
@github-actions github-actions bot mentioned this pull request Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Implement Cancel Socket/Port Forwarding
4 participants