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 (https://github.com/crystal-lang/rfcs/pull/7).
Currently, individual system implementations of
System::FileDescriptor
andSystem::Socket
implementIO#unbuffered_read
andIO#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, callingsystem_write
multiple times if necessary. (Looks like this wasn't implemented correctly inSocket
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 (https://github.com/crystal-lang/rfcs/pull/7).