• Subodh Iyengar's avatar
    Add TFO support to AsyncSSLSocket · 889fe563
    Subodh Iyengar authored
    Summary:
    This adds TFO support to AsyncSSLSocket which
    uses the support for TFO from AsyncSocket.
    
    Because of the way AsyncSSLSocket inherits from
    AsyncSocket it is tricky.
    
    The following changes were made:
    1. Openssl internally will treat only errors with return
    code -1 as READ_REQUIRED or WRITE_REQUIRED errors. So this
    diff changes the return value of the errors in the TFO fallback
    cases to -1.
    
    2. In case we fallback after SSL_connect() to a normal connect,
    we would have to restart the connection process after connect
    succeeds. To do this this overrides the connection success callback
    and restarts the connection before sending the callback to AsyncSocket
    because sometimes callbacks might synchronously call sslConn() in the
    normal connect cases.
    
    3. Delegated bioWrite to call sendSocketMessage instead of sendmsg directly.
    
    Reviewed By: djwatson
    
    Differential Revision: D3391735
    
    fbshipit-source-id: 61434f6de4a9c3d03973c9ab9e51eb49e751e5cf
    889fe563
AsyncSocket.h 29 KB