node
node copied to clipboard
tls: Prevent zero length write() syscalls.
The current behavior is performing a zero length write() syscall when the write is empty.
This change removes that behavior and prevents a call to the kernel. This change assumes that the zero length write completed async.
- [x]
make -j4 test
(UNIX), orvcbuild test
(Windows) passes - [x] commit message follows
CI: https://ci.nodejs.org/job/node-test-pull-request/28693/
@rustyconover Two things…
- Does this affect the TCP timeout in any way? My guess is that it doesn’t, but I’d like to be sure.
- If your goal is to skip zero-length
write()
calls, I’d assume that a better place is to either do that by skippingDoTryWrite()
inStreamBase::Write()
(that would affect all C++ streams) or inLibuvStreamWrap::DoTryWrite()
(which affects libuv-backed streams, including network sockets)
Skipping the zero length writes at the StreamBase level would be fine so long as the write callbacks are still handled correctly. I think I'd rather see that approach. That said, when calling DoWrite with an array of uv_buf_t instances, we'd need to look at how to handle an empty uv_buf_t in the middle of the array. What should happen with that. Otherwise I like the general direction of this.
@rustyconover ... looks like this stalled out. Do you still want to move this forward?
@jasnell I'd like to see it finished, but right now I've just been a bit distracted.
This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open.
I still think it is a good idea, it is just pending tuits.
(The stalled bot doesn't appear to be working, so I've manually closed. Feel free to reopen if this is no longer stalled)