When writing user-provided binary data, we have two cases:
- If the user data is small and fits in our write buffer, we copy it there just like any other value.
- If it's bigger than the buffer, we flush the buffer and then write the user data directly to the socket.
The logic is to minimize system calls/TCP packets for small user data, but bypass the internal buffer for larger data (saving the in-memory copying).
The direct write mechanism is currently implemented synchronously with no async option.