proxygen
|
#include <HTTPUpstreamSession.h>
Public Types | |
using | FilterIteratorFn = std::function< void(HTTPCodecFilter *)> |
Public Types inherited from proxygen::HTTPSession | |
using | UniquePtr = std::unique_ptr< HTTPSession, Destructor > |
Public Types inherited from proxygen::HTTPSessionBase | |
enum | SessionType { SessionType::HTTP, SessionType::HQ } |
using | FilterIteratorFn = std::function< void(HTTPCodecFilter *)> |
Private Member Functions | |
~HTTPUpstreamSession () override | |
void | setupOnHeadersComplete (HTTPTransaction *, HTTPMessage *) override |
HTTPTransaction::Handler * | getTransactionTimeoutHandler (HTTPTransaction *txn) override |
bool | allTransactionsStarted () const override |
bool | onNativeProtocolUpgrade (HTTPCodec::StreamID streamID, CodecProtocol protocol, const std::string &protocolString, HTTPMessage &msg) override |
void | maybeAttachSSLContext (folly::SSLContextPtr sslContext) const |
void | maybeDetachSSLContext () const |
Private Attributes | |
uint8_t | maxVirtualPriorityLevel_ {0} |
std::shared_ptr< const PriorityMapFactory > | priorityMapFactory_ |
std::unique_ptr< PriorityAdapter > | priorityAdapter_ |
Definition at line 22 of file HTTPUpstreamSession.h.
using proxygen::HTTPUpstreamSession::FilterIteratorFn = std::function<void(HTTPCodecFilter*)> |
Definition at line 89 of file HTTPUpstreamSession.h.
|
inline |
sock | An open socket on which any applicable TLS handshaking has been completed already. |
localAddr | Address and port of the local end of the socket. |
peerAddr | Address and port of the remote end of the socket. |
codec | A codec with which to parse/generate messages in whatever HTTP-like wire format this session needs. |
maxVirtualPri | Number of virtual priority nodes to represent fixed priority levels. |
Definition at line 34 of file HTTPUpstreamSession.h.
References proxygen::HTTPSessionBase::codec_, proxygen::HTTPCodec::getTransportDirection(), folly::AsyncSocket::setBufferCallback(), proxygen::HTTPSession::sock_, and proxygen::UPSTREAM.
|
inline |
Definition at line 66 of file HTTPUpstreamSession.h.
|
overrideprivate |
|
overrideprivatevirtual |
Implements proxygen::HTTPSession.
Definition at line 119 of file HTTPUpstreamSession.cpp.
References proxygen::HTTPSession::transactions_.
Referenced by setupOnHeadersComplete().
|
overridevirtual |
Implements proxygen::HTTPSessionBase.
Definition at line 174 of file HTTPUpstreamSession.cpp.
References proxygen::HTTP2PriorityQueue::attachThreadLocals(), proxygen::HTTPSessionBase::codec_, proxygen::FilterChain< T1, T2, FilterType, set_callback, TakeOwnership >::foreach(), maybeAttachSSLContext(), proxygen::HTTPSession::rescheduleLoopCallbacks(), proxygen::HTTPSession::resumeReadsImpl(), proxygen::HTTPSessionBase::setController(), proxygen::HTTPCodec::setHeaderCodecStats(), proxygen::HTTPSession::setSessionStats(), proxygen::HTTPSession::sock_, proxygen::HTTPSession::timeout_, and proxygen::HTTPSession::txnEgressQueue_.
|
overridevirtual |
Implements proxygen::HTTPSessionBase.
Definition at line 206 of file HTTPUpstreamSession.cpp.
References proxygen::HTTPSession::cancelLoopCallbacks(), proxygen::HTTPSessionBase::codec_, proxygen::HTTP2PriorityQueue::detachThreadLocals(), wangle::ManagedConnection::getConnectionManager(), maybeDetachSSLContext(), proxygen::HTTPSession::pauseReadsImpl(), proxygen::HTTPSessionBase::setController(), proxygen::HTTPCodec::setHeaderCodecStats(), proxygen::HTTPSession::setSessionStats(), proxygen::HTTPSession::sock_, proxygen::HTTPSession::transactions_, and proxygen::HTTPSession::txnEgressQueue_.
void proxygen::HTTPUpstreamSession::detachTransactions | ( | ) |
Definition at line 158 of file HTTPUpstreamSession.cpp.
References proxygen::HTTPSession::detach(), and proxygen::HTTPSession::transactions_.
|
inlineoverridevirtual |
Drains the current transactions and prevents new transactions from being created on this session. When the number of transactions reaches zero, this session will shutdown the transport and delete itself.
Reimplemented from proxygen::HTTPSession.
Definition at line 137 of file HTTPUpstreamSession.h.
References proxygen::HTTPSession::drain().
Referenced by ProxyService::SessionWrapper::~SessionWrapper().
|
inlineoverridevirtual |
Reimplemented from proxygen::HTTPSession.
Definition at line 141 of file HTTPUpstreamSession.h.
References proxygen::HTTPSession::getHTTPPriority(), priorityAdapter_, and ~HTTPUpstreamSession().
|
overrideprivatevirtual |
Called by transactionTimeout() if the transaction has no handler.
Implements proxygen::HTTPSession.
Definition at line 113 of file HTTPUpstreamSession.cpp.
Referenced by setupOnHeadersComplete().
|
overridevirtual |
Returns true if the session is shutting down
Implements proxygen::HTTPSessionBase.
Definition at line 52 of file HTTPUpstreamSession.cpp.
References proxygen::HTTPSession::draining_, proxygen::HTTPSession::readsShutdown(), proxygen::HTTPSession::resetAfterDrainingWrites_, proxygen::HTTPSession::sock_, proxygen::HTTPSession::writesDraining_, and proxygen::HTTPSession::writesShutdown().
Referenced by isReusable().
|
overridevirtual |
Implements proxygen::HTTPSessionBase.
Definition at line 165 of file HTTPUpstreamSession.cpp.
References proxygen::HTTPSession::getNumIncomingStreams(), proxygen::HTTPSession::sock_, proxygen::HTTPSession::transactions_, and proxygen::HTTPSession::writesPaused().
|
overridevirtual |
Returns true if the underlying transport has completed full handshake.
Implements proxygen::HTTPSessionBase.
Definition at line 22 of file HTTPUpstreamSession.cpp.
References proxygen::HTTPSession::sock_.
|
overridevirtual |
Returns true if this session has no open transactions and the underlying transport can be used again in a new request.
Implements proxygen::HTTPSessionBase.
Definition at line 26 of file HTTPUpstreamSession.cpp.
References proxygen::HTTPSessionBase::codec_, proxygen::HTTPSession::hasMoreWrites(), proxygen::HTTPSession::ingressError_, proxygen::HTTPCodec::isBusy(), isClosing(), proxygen::HTTPCodec::isReusable(), folly::HHWheelTimer::Callback::isScheduled(), proxygen::HTTPSession::liveTransactions_, proxygen::HTTPSession::numActiveWrites_, proxygen::HTTPSession::sock_, proxygen::HTTPCodec::supportsParallelRequests(), and proxygen::HTTPSession::writeTimeout_.
|
private |
Definition at line 195 of file HTTPUpstreamSession.cpp.
References proxygen::HTTPSession::sock_.
Referenced by attachThreadLocals(), and setupOnHeadersComplete().
|
private |
Definition at line 228 of file HTTPUpstreamSession.cpp.
References proxygen::HTTPSession::sock_.
Referenced by detachThreadLocals(), and setupOnHeadersComplete().
|
overridevirtual |
Creates a new transaction on this upstream session. Invoking this function also has the side-affect of starting reads after this event loop completes.
handler | The request handler to attach to this transaction. It must not be null. |
Implements proxygen::HTTPSessionBase.
Definition at line 91 of file HTTPUpstreamSession.cpp.
References proxygen::HTTPSessionBase::codec_, proxygen::HTTPCodec::createStream(), proxygen::HTTPSession::createTransaction(), proxygen::HTTPSession::draining_, proxygen::HTTPCodec::NoExAttributes, proxygen::HTTPCodec::NoStream, proxygen::HTTPSession::setNewTransactionPauseState(), proxygen::HTTPSession::started_, startNow(), and proxygen::HTTPSessionBase::supportsMoreTransactions().
Referenced by CurlService::CurlClient::connectSuccess(), and ProxyService::ProxyHandler::connectSuccess().
|
overrideprivatevirtual |
Called upon receipt of a valid protocol switch. Return false if protocol switch could not be completed.
Reimplemented from proxygen::HTTPCodec::Callback.
Definition at line 128 of file HTTPUpstreamSession.cpp.
References proxygen::HTTPCodec::addPriorityNodes(), codec, proxygen::HTTPSessionBase::codec_, proxygen::HTTP_2, maxVirtualPriorityLevel_, folly::gen::move, proxygen::HTTPSession::onNativeProtocolUpgradeImpl(), proxygen::HTTPSession::scheduleWrite(), proxygen::HTTPSession::txnEgressQueue_, proxygen::UPSTREAM, and proxygen::HTTPSession::writeBuf_.
Referenced by setupOnHeadersComplete().
|
inlineoverrideprivatevirtual |
Called by onHeadersComplete(). Currently a no-op for upstream.
Implements proxygen::HTTPSession.
Definition at line 155 of file HTTPUpstreamSession.h.
References allTransactionsStarted(), getTransactionTimeoutHandler(), maybeAttachSSLContext(), maybeDetachSSLContext(), onNativeProtocolUpgrade(), streamID, and string.
|
overridevirtual |
Start reading from the transport and send any introductory messages to the remote side. This function must be called once per session to begin reads.
Reimplemented from proxygen::HTTPSession.
Definition at line 69 of file HTTPUpstreamSession.cpp.
References proxygen::HTTPCodec::addPriorityNodes(), proxygen::HTTPSessionBase::codec_, maxVirtualPriorityLevel_, priorityAdapter_, priorityMapFactory_, proxygen::HTTPSession::scheduleWrite(), proxygen::HTTPSession::startNow(), proxygen::HTTPSession::txnEgressQueue_, and proxygen::HTTPSession::writeBuf_.
Referenced by newTransaction().
|
private |
Definition at line 174 of file HTTPUpstreamSession.h.
Referenced by onNativeProtocolUpgrade(), and startNow().
|
private |
Definition at line 177 of file HTTPUpstreamSession.h.
Referenced by getHTTPPriority(), and startNow().
|
private |
Definition at line 176 of file HTTPUpstreamSession.h.
Referenced by startNow().