22 class HTTPSessionController;
23 class HTTPSessionStats;
24 class HTTPTransaction;
25 class ByteEventTracker;
87 std::unique_ptr<HTTPCodec>
codec);
95 kDefaultReadBufLimit = limit;
96 VLOG(3) <<
"read buffer limit: " << int(limit / 1000) <<
"KB";
100 maxReadBufferSize_ = bytes;
108 egressBodySizeLimit_ = limit;
116 kDefaultWriteBufLimit =
max;
120 infoCallback_ = callback;
124 return infoCallback_;
128 sessionStats_ = stats;
146 virtual bool hasActiveTransactions()
const = 0;
152 return (getNumOutgoingStreams() < getMaxConcurrentOutgoingStreams());
155 virtual uint32_t getNumOutgoingStreams()
const = 0;
159 return historicalMaxOutgoingStreams_;
162 virtual uint32_t getNumIncomingStreams()
const = 0;
165 virtual uint32_t getMaxConcurrentOutgoingStreamsRemote()
const = 0;
168 return std::min(maxConcurrentOutgoingStreamsConfig_,
169 getMaxConcurrentOutgoingStreamsRemote());
175 controller_ = controller;
178 initCodecHeaderIndexingStrategy();
191 return codec_->getProtocol();
205 virtual void setFlowControl(
206 size_t initialReceiveWindow,
207 size_t receiveStreamWindowSize,
208 size_t receiveSessionWindowSize) = 0;
213 virtual void setEgressSettings(
const SettingsList& inSettings) = 0;
219 h2PrioritiesEnabled_ = enabled;
223 return h2PrioritiesEnabled_;
233 maxConcurrentOutgoingStreamsConfig_ = num;
239 virtual void setMaxConcurrentIncomingStreams(
uint32_t num) = 0;
246 return writeBufLimit_;
250 writeBufLimit_ = limit;
251 VLOG(4) <<
"write buffer limit: " << int(limit / 1000) <<
"KB";
255 readBufLimit_ = limit;
263 virtual void startNow() = 0;
268 virtual size_t sendSettings() = 0;
275 virtual size_t sendPing() = 0;
297 std::unique_ptr<folly::IOBuf> ,
298 std::vector<fizz::Extension> ) {
303 return transactionSeqNo_;
307 DCHECK_GT(transactionSeqNo_, 0) <<
"No idle time for the first transaction";
309 return latestIdleDuration_;
313 prioritySample_ = sampled;
327 return transportInfo_;
329 virtual bool getCurrentTransportInfo(
332 virtual bool getCurrentTransportInfoWithoutUpdate(
337 virtual void enableDoubleGoawayDrain() = 0;
340 return transportInfo_;
346 virtual bool connCloseByRemote() = 0;
382 getHTTPPriority(
uint8_t level) = 0;
390 virtual std::unique_ptr<PriorityAdapter> createVirtualStreams(
397 virtual bool isDetachable(
bool checkSocket)
const = 0;
399 virtual void attachThreadLocals(
408 virtual void detachThreadLocals(
bool detachSSLContext=
false) = 0;
420 virtual bool isReplaySafe()
const = 0;
426 virtual bool isReusable()
const = 0;
431 virtual bool isClosing()
const = 0;
438 virtual void drain() = 0;
446 void enableExHeadersSettings() noexcept;
448 bool isExHeadersEnabled() noexcept {
449 return exHeadersEnabled_;
460 bool onBodyImpl(std::unique_ptr<folly::IOBuf> chain,
size_t length,
463 bool notifyBodyProcessed(
uint32_t bytes);
470 return pendingReadSize_ > readBufLimit_;
478 return pendingWriteSize_ > writeBufLimit_;
482 DCHECK(delta >= 0 ||
uint64_t(-delta) <= pendingWriteSize_);
483 pendingWriteSize_ += delta;
487 if (transactionSeqNo_ >= 1) {
498 return prioritySample_;
502 if (outgoingStreams > historicalMaxOutgoingStreams_) {
503 historicalMaxOutgoingStreams_ = outgoingStreams;
509 closeReason_ = reason;
513 static void handleLastByteEvents(
520 void runDestroyCallbacks();
526 void onCodecChanged();
534 void initCodecHeaderIndexingStrategy();
539 void attachToSessionController();
588 return std::chrono::milliseconds(0);
600 std::chrono::seconds latestIdleDuration_{};
621 kDefaultMaxConcurrentOutgoingStreams};
645 bool prioritySample_:1;
646 bool h2PrioritiesEnabled_:1;
651 bool exHeadersEnabled_:1;
static uint32_t kDefaultReadBufLimit
bool egressLimitExceeded() const
void setWriteBufferLimit(uint32_t limit)
virtual void onActivateConnection(const HTTPSessionBase &)
folly::SocketAddress localAddr_
virtual void onIngressLimitExceeded(const HTTPSessionBase &)
HTTPCodecFilterChain codec_
void setReadBufferLimit(uint32_t limit)
virtual void onPingReplyReceived()
virtual void onWrite(const HTTPSessionBase &, size_t)
const SocketAddress peerAddr
static void setFlowControlledBodySizeLimit(uint32_t limit)
virtual void onSettingsOutgoingStreamsNotFull(const HTTPSessionBase &)
virtual void onEgressBuffered(const HTTPSessionBase &)
void onCreateTransaction()
void setMaxConcurrentOutgoingStreams(uint32_t num)
static uint32_t maxReadBufferSize_
virtual void onIngressError(const HTTPSessionBase &, ProxygenError)
EventBase * getEventBase()
virtual void onIngressEOF()
virtual void onCreate(const HTTPSessionBase &)
internal::ArgsMatcher< InnerMatcher > Args(const InnerMatcher &matcher)
bool isPrioritySampled() const
std::unique_ptr< Codec > codec_
void onNewOutgoingStream(uint32_t outgoingStreams)
requires E e noexcept(noexcept(s.error(std::move(e))))
requires And< SemiMovable< VN >... > &&SemiMovable< E > auto error(E e)
void updatePendingWriteSize(int64_t delta)
virtual ~HTTPSessionBase()
static void setDefaultReadBufferLimit(uint32_t limit)
virtual void onFullHandshakeCompletion(const HTTPSessionBase &)
virtual void onIngressMessage(const HTTPSessionBase &, const HTTPMessage &)
static void setMaxReadBufferSize(uint32_t bytes)
void handler(int, siginfo_t *, void *)
ConnectionCloseReason getConnectionCloseReason() const
std::function< void(HTTPCodecFilter *)> FilterIteratorFn
HTTPSessionController * getController()
virtual bool getHTTP2PrioritiesEnabled() const
void addCodecFilter(Args &&...args)
uint32_t getMaxConcurrentOutgoingStreams() const
virtual ~HTTPPriorityMapFactoryProvider()=default
uint32_t getWriteBufferLimit() const
uint64_t getNumTxnServed() const
void setCloseReason(ConnectionCloseReason reason)
virtual void onTransactionDetached(const HTTPSessionBase &)
const wangle::TransportInfo & getSetupTransportInfo() const noexcept
virtual void onSettingsOutgoingStreamsFull(const HTTPSessionBase &)
virtual void onSettingsAck(const HTTPSessionBase &)
std::shared_ptr< SSLContext > SSLContextPtr
void setPrioritySampled(bool sampled)
void setHTTP2PrioritiesEnabled(bool enabled)
virtual CodecProtocol getCodecProtocol() const
virtual void onPingReplySent(int64_t)
virtual void onRead(const HTTPSessionBase &, size_t)
bool ingressLimitExceeded() const
uint32_t getHistoricalMaxOutgoingStreams() const
SteadyClock::time_point TimePoint
virtual void onIngressPaused(const HTTPSessionBase &)
std::vector< HTTPSetting > SettingsList
std::chrono::milliseconds millisecondsSince(std::chrono::time_point< ClockType > t)
void setController(HTTPSessionController *controller)
std::chrono::seconds getLatestIdleTime() const
virtual void onRequestEnd(const HTTPSessionBase &, uint32_t)
virtual void onSettings(const HTTPSessionBase &, const SettingsList &)
std::chrono::time_point< ClockType > getCurrentTime()
const SocketAddress localAddr
InfoCallback * getInfoCallback() const
constexpr uint32_t kDefaultMaxConcurrentOutgoingStreams
void setInfoCallback(InfoCallback *callback)
static void setDefaultWriteBufferLimit(uint32_t max)
virtual HTTPCodec::StreamID sendPriority(http2::PriorityUpdate pri)=0
folly::SocketAddress peerAddr_
virtual void onEgressBufferCleared(const HTTPSessionBase &)
static uint32_t kDefaultWriteBufLimit
virtual void onDeactivateConnection(const HTTPSessionBase &)
virtual void onDestroy(const HTTPSessionBase &)
virtual void setSessionStats(HTTPSessionStats *stats)
const folly::SocketAddress & getPeerAddress() const noexcept
const folly::SocketAddress & getLocalAddress() const noexcept
wangle::TransportInfo & getSetupTransportInfo() noexcept
bool timePointInitialized(const T &time)
static uint32_t egressBodySizeLimit_
virtual size_t sendCertificateRequest(std::unique_ptr< folly::IOBuf >, std::vector< fizz::Extension >)
virtual void onFlowControlWindowClosed(const HTTPSessionBase &)
bool supportsMoreTransactions() const
std::chrono::milliseconds getIdleTime() const override
wangle::TransportInfo transportInfo_
std::chrono::seconds secondsSince(std::chrono::time_point< ClockType > t)
virtual void onRequestBegin(const HTTPSessionBase &)