Enabled `TCP_CORK` when sending a file
tanguilp opened this issue · comments
The TCP option TCP_CORK
can be used to coalesce headers with the file being sent with the sendfile
syscall:
If you plan to use sendfile() for sending files to a TCP socket, but need to send some header data in front of the file contents, you will find it useful to employ the TCP_CORK option, described in tcp(7), to minimize the number of packets and to tune performance
(from the manual of sendfile
for Linux - implementations differ between OSes).
It'd be nice to enable it when sending file, although this might be a bit hard to pass the needed parameters to ranch because we need:
- to enabled it before sending the headers
- to disable it after calling sendfile
It also doesn't seem to be supported in inet
, but only in the OTP22+ socket
module.