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

An attempt at #401 - removing TX busywait #408

Merged
merged 7 commits into from
Dec 7, 2024
Merged

An attempt at #401 - removing TX busywait #408

merged 7 commits into from
Dec 7, 2024

Conversation

Eugeny
Copy link
Owner

@Eugeny Eugeny commented Dec 4, 2024

No description provided.

Copy link
Contributor

@EpicEric EpicEric left a comment

Choose a reason for hiding this comment

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

I don't see a way where the changes to the window size are communicated back to the watchers.

Otherwise this might work (I'm also not very familiar with low-level async), although something like Notify might be a better fit as it only lets in one task at a time, which is already the case given the Mutex for the window size.

russh/src/channels/io/tx.rs Outdated Show resolved Hide resolved
@Eugeny
Copy link
Owner Author

Eugeny commented Dec 5, 2024

Dang, I wasn't testing it correctly in the first place, thanks for the fix!
I've wrapped the window size updates in a fn so that the notifier fires after the update has already happened just in case there might be an await point in the future between the two.

I'm also wondering whether notify_all is needed instead of notify_one as a freshly awakened writer can be dropped before it is polled again.

@EpicEric
Copy link
Contributor

EpicEric commented Dec 5, 2024

Good point, that seems like the safer solution. Although that might cause unnecessary waking up of all writers.

I wonder if dropping a writer should invoke notify_one instead to avoid that (seemingly minor) issue.

@EpicEric

This comment was marked as resolved.

EpicEric added a commit to EpicEric/russh that referenced this pull request Dec 5, 2024
- Guard against empty buffer
- Fix tests not checking for panics
- Add test_channel_window_size with multiple writers
@Eugeny
Copy link
Owner Author

Eugeny commented Dec 6, 2024

@EpicEric is there anything you'd like to see added here?

@EpicEric
Copy link
Contributor

EpicEric commented Dec 6, 2024

This looks good to me.

@Eugeny Eugeny marked this pull request as ready for review December 7, 2024 18:47
@Eugeny Eugeny merged commit a5c4adc into main Dec 7, 2024
6 checks passed
@Eugeny Eugeny deleted the 401-busywait branch December 7, 2024 18:47
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.

2 participants