sthttpd
sthttpd copied to clipboard
Please setsockopt with TCP_FASTOPEN. Thanks.
TCP Fast Open (TFO) is an extension to speed up the opening of successive Transmission Control Protocol (TCP) connections between two endpoints. It works by using a TFO cookie (a TCP option), which is a cryptographic cookie stored on the client and set upon the initial connection with the server.[1] When the client later reconnects, it sends the initial SYN packet along with the TFO cookie data to authenticate itself. If successful, the server may start sending data to the client even before the reception of the final ACK packet of the three-way handshake, skipping that way a round-trip delay and lowering the latency in the start of data transmission.
https://tools.ietf.org/html/rfc7413
Here is an example commit: https://github.com/shadowsocks/shadowsocks-libev/pull/71/commits/5d0696f6551ea2e7f1f6822210eeddebe1fd67f3
This should only be added if the target supports it, so an ifdef around the setsockopt() call. Pretty straightforward otherwise.