tor-proto: Initial KIST support (Linux-only)
This adds support for setting TCP_NOTSENT_LOWAT on Linux. Support for other platforms will be added later, as part of #1801.
This is option 2 from #1728 (comment 3137938), and so should only be enabled once !2675 (merged) is merged:
For example, tor#33763 (closed) suggests setting
TCP_NOTSENT_LOWAT
to 1.
By setting this option to 1, the socket will only become writable if its number of not-sent bytes is below 1. This might just be a good enough heuristic (thus enabling us to avoid having to implement the full KIST calculations that c-tor does). OTOH, the option might not be good enough, because it assumes the socket is ready for more data if the number of not-sent bytes drops to 0, which may not necessarily be the case: it is possible that the outgoing buffer is filled with sent-but-unacked data, and thus not ready send anymore, despite
notsent
being 0.
Note: #1728 (closed) and #1730 (closed) talk about adding a new TransportImplHelper
and/or modifying DefaultTransport
, but this branch takes a different, simpler approach, which doesn't involve modifying any of the transport impls.
Closes #1728 (closed), #1729 (closed), #1730 (closed)