HTTPTransaction* HTTPUpstreamSession::newTransaction(HTTPTransaction::Handler* handler, int8_t priority) { CHECK_NOTNULL(handler); if (!supportsMoreTransactions() || draining_) { // This session doesn't support any more parallel transactions return nullptr; } if (!started_) { startNow(); } auto txn = createTransaction(codec_->createStream(), 0, priority); if (txn) { DestructorGuard dg(this); auto txnID = txn->getID(); txn->setHandler(handler); setNewTransactionPauseState(txnID); } return txn; }
void HTTPDownstreamSession::setupOnHeadersComplete(HTTPTransaction* txn, HTTPMessage* msg) { CHECK(!txn->getHandler()); // We need to find a Handler to process the transaction. // Note: The handler is responsible for freeing itself // when it has finished processing the transaction. The // transaction is responsible for freeing itself when both the // ingress and egress messages have completed (or failed). HTTPTransaction::Handler* handler = nullptr; // In the general case, delegate to the handler factory to generate // a handler for the transaction. handler = controller_->getRequestHandler(*txn, msg); CHECK(handler); txn->setHandler(handler); setNewTransactionPauseState(txn); }