Hi - it'd be handy if data could be sent through a stream without an (extra) userspace/kernelspace copy, which can be done with the splice system call on Linux and sendfile on some BSDs.
The idea would be to send the data frame's header directly, then pump with splice until all the bytes have been sent. Presumably it should do whatever send_data does if you try to send more bytes than SETTINGS_MAX_FRAME_SIZE.
I had a look at proto/streams/streams.rs and it might not actually need much type surgery - SendStream is already parameterised over the data it sends, so switching from Bytes to a sum of Bytes and a file descriptor + the range to splice should be quite possible.
Hi - it'd be handy if data could be sent through a stream without an (extra) userspace/kernelspace copy, which can be done with the
splice
system call on Linux andsendfile
on some BSDs.The idea would be to send the data frame's header directly, then pump with
splice
until all the bytes have been sent. Presumably it should do whateversend_data
does if you try to send more bytes thanSETTINGS_MAX_FRAME_SIZE
.I had a look at
proto/streams/streams.rs
and it might not actually need much type surgery -SendStream
is already parameterised over the data it sends, so switching fromBytes
to a sum ofBytes
and a file descriptor + the range to splice should be quite possible.