Add support for TFO connections
authorSubodh Iyengar <subodh@fb.com>
Tue, 31 May 2016 04:08:33 +0000 (21:08 -0700)
committerFacebook Github Bot 2 <facebook-github-bot-2-bot@fb.com>
Tue, 31 May 2016 04:23:28 +0000 (21:23 -0700)
commit539129455f6c8300c5bd5b72379b29823266c7d6
tree2b39b72656a090cf0723e4ab425dc164933691ac
parent46f3788d8acb3d351698d9ffff551807c807caa7
Add support for TFO connections

Summary:
This adds support to establish connections
over TFO.

The API introduced here retains the same
connect() + write() api that clients currently
use.

If enableTFO() is called then the connect will
be deferred to the first write. This only works
with request response protocols since a write
must trigger the connect. There is a tradeoff here
for the simpler API, and we can address this with
other signals such as a short timeout in the future.

Even though the client might enable TFO, the program
might run on machines without TFO support.
There were 2 choices for supporting machines where
TFO might not be enabled:
1. Fallback to normal connect if tfo sendmsg fails
2. Check tfo supported on the machine before using it

Both these have their tradeoffs, however option 1 does
not require us to read from procfs in the common code
path.

Reviewed By: Orvid

Differential Revision: D3327480

fbshipit-source-id: 9ac3a0c7ad2d206b158fdc305641fedbd93aa44d
folly/detail/SocketFastOpen.cpp
folly/detail/SocketFastOpen.h
folly/io/async/AsyncSocket.cpp
folly/io/async/AsyncSocket.h
folly/io/async/test/AsyncSocketTest.h
folly/io/async/test/AsyncSocketTest2.cpp
folly/io/async/test/BlockingSocket.h
folly/io/async/test/SocketClient.cpp [new file with mode: 0644]