thrift/lib/cpp2/transport/rocket/client/RequestContextQueue.cpp
// If the caller is waiting on a matching response via waitForResponse(), this
// function is called on the read path once the entire response payload has
// arrived.
// If the caller instead only calls waitForWriteToComplete(), this is called
// once the write to the socket has completed.
If the caller is waiting on a matching response via waitForResponse(), this
function is called on the read path once the entire response payload has
arrived.
If the caller instead only calls waitForWriteToComplete(), this is called
once the write to the socket has completed.
If the caller is waiting on a matching response via waitForResponse () this function is called on the read path once the entire response payload has arrived . If the caller instead only calls waitForWriteToComplete () this is called once the write to the socket has completed .
void RequestContextQueue::markAsResponded(RequestContext& req) noexcept {
  untrackIfExpectingResponse(req);
  if (LIKELY(req.state() == State::WRITE_SENT)) {
    req.state_ = State::RESPONSE_RECEIVED;
    writeSentQueue_.erase(writeSentQueue_.iterator_to(req));
    req.baton_.post();
  } else {
    DCHECK(req.expectingResponse());
    DCHECK(req.state() == State::WRITE_SENDING);
    req.state_ = State::RESPONSE_RECEIVED;
  }
}
void RequestContextQueue :: markAsResponded ( RequestContext & req ) noexcept { untrackIfExpectingResponse ( req ) ; if ( LIKELY ( req . state ( ) == State :: WRITE_SENT ) ) { req . state_ = State :: RESPONSE_RECEIVED ; writeSentQueue_ . erase ( writeSentQueue_ . iterator_to ( req ) ) ; req . baton_ . post ( ) ; } else { DCHECK ( req . expectingResponse ( ) ) ; DCHECK ( req . state ( ) == State :: WRITE_SENDING ) ; req . state_ = State :: RESPONSE_RECEIVED ; } }
If the caller is waiting on a matching response via waitForResponse(), this
function is called on the read path once the entire response payload has
arrived.
If the caller is waiting on a matching response via waitForResponse () this function is called on the read path once the entire response payload has arrived .
// Response arrived before AsyncSocket WriteCallback fired; we let the write // complete. writeSuccess()/writeErr() are therefore responsible for // handling this request's final queue transition and posting the baton.