• Anirudh Ramachandran's avatar
    Make AsyncSSLSocket aware of OpenSSL 1.1.0's async API · 72e652d1
    Anirudh Ramachandran authored
    Summary:
    OpenSSL 1.1.0 uses a fiber-based (makecontext/swapcontext) API to do
    asynchronous operations. When some operation deep inside the stack calls
    ASYNC_pause_job, SSL_accept returns -1 with error SSL_ERROR_WANT_ASYNC.
    OpenSSL chose to use fds to wait on, so after SSL_accept returns, we create an
    AsyncPipeReader to restart SSL_accept when the pipe becomes readable, which is our
    indication that the async job processing has finished.
    
    Also implemented a test to kick off an async job in a different thread that creates a pipe
    and gives the read end back to the SSL* before calling ASYNC_pause_job
    
    Reviewed By: yfeldblum
    
    Differential Revision: D5977514
    
    fbshipit-source-id: 3aba2e45b9357dc28cf7cf785654072f8ba8dd65
    72e652d1
AsyncSSLSocketTest.cpp 78.8 KB