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

Extract #system_read and #system_write for FileDescriptor and Socket #14626

Merged

Conversation

straight-shoota
Copy link
Member

@straight-shoota straight-shoota commented May 24, 2024

Currently, individual system implementations of System::FileDescriptor and System::Socket implement IO#unbuffered_read and IO#unbuffered_write directly. This patch pulls the implementation up to be shared between all platforms, and instead delegates to #system_read and #system_write.

#unbuffered_write is now responsible for ensuring that the entire content of the slice is written, calling system_write multiple times if necessary. (Looks like this wasn't implemented correctly in Socket on Windows before)

This is a simplification step in preparation for a bigger refactoring which will delegate #system_read and #system_write to the event loop (crystal-lang/rfcs#7).

src/io/evented.cr Show resolved Hide resolved
@straight-shoota straight-shoota added this to the 1.13.0 milestone May 24, 2024
@straight-shoota straight-shoota merged commit f3be084 into crystal-lang:master May 25, 2024
122 checks passed
@straight-shoota straight-shoota deleted the refactor/system_write branch May 25, 2024 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants