Honestly it would probably help a lot to quote-reply
Noted, doing that from here.
Windows never does a partial send, so if we're below SNDBUF the buffer is effectively unlimited
Understood, and that is a better framing than mine.
they did run into that problem: [curl/curl#6245](https://github.com/curl/curl/issues/6245) and then fixed it by sending 0 bytes to every socket before polling it
That explains the piece I had wrong, thank you. So the assumption curl relies on is that a send which is accepted implies writable, and Linux breaks it by accepting the send while failing the poll.
reset AFD_POLL_WRITE like we currently do in send_socket_completion_callback if the iosb fails OR the socket isn't writable according to POLLOUT
[wine-fdwrite-rearm.patch](/uploads/d231e9f8fb6d128d5d278d1e104fcce4/wine-fdwrite-rearm.patch) I have this built already and have attached it. Mine sits in `poll_socket()` rather than at send completion, clearing `reported_events & AFD_POLL_WRITE` when a poll sees a connected stream that cannot accept a send. It applies on top of the writability patch in this MR rather than stock master, since its context needs `sock_stream_send_ready()`. I did not submit it because it contradicts the FD_WRITE re-arm test in this MR. I checked real Windows and it does not re-arm on a poll-observed not-writable. That test would need to become todo_wine, or the divergence accepted on purpose. Measured on a live upload, it took aggregate throughput from 13.0-13.9 Mbit/s to 40.9. That was on top of the writability patch rather than instead of it, so whether the re-arm alone is enough is untested. I can test that. Your version also answers Paul's objection in a way mine does not, since it needs nothing from the kernel beyond POLLOUT. If you want it at send completion as you describe, I will build it that way rather than push mine.
inflating the SNDBUF value we pass to Linux so that it's closer to the 2/3 mark
The multiplier depends on the exact condition the kernel tests, so I would rather derive it than assume 2/3. It also carries the same kernel-internal dependency Paul objected to, moved rather than removed. [wine-fdwrite-rearm.patch](/uploads/d32153d4c5b48e1bc6ee53414b7c42ad/wine-fdwrite-rearm.patch) -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11272#note_148673