• Alan Frindell's avatar
    Prefer returning read data on cancel · 06e4b1aa
    Alan Frindell authored
    Summary:
    It's possible that AsyncTransport read completed successfully in one loop, then the read coro gets a cancellation request.  In this case, prefer to return successfully with the read data.
    
    Read cancellation need not be fatal, eg: an application may just want to interrupt a read and come back to it later.  In this case, the successfully read data could be lost.
    
    In particular, if an EOF was lost, the application might start another read, AsyncSocket::setReadCB can assert in invalidState(ReadCallback*) because the DestructorGuard count is 0.
    
    Reviewed By: yairgott
    
    Differential Revision: D30964504
    
    fbshipit-source-id: ea963e6572f2bb552899d3b1e6274bbd0bcdc265
    06e4b1aa
TransportTest.cpp 11.2 KB