@@ -169,7 +169,7 @@ class HTTPSessionBase : public wangle::ManagedConnection {
169169 uint32_t maxEventsPerInterval,
170170 std::chrono::milliseconds intervalDuration);
171171
172- InfoCallback* getInfoCallback () const {
172+ [[nodiscard]] InfoCallback* getInfoCallback () const {
173173 return infoCallback_;
174174 }
175175
@@ -178,13 +178,14 @@ class HTTPSessionBase : public wangle::ManagedConnection {
178178
179179 virtual void setSessionStats (HTTPSessionStats* stats);
180180
181- virtual HTTPTransaction::Transport::Type getType () const noexcept = 0;
181+ [[nodiscard]] virtual HTTPTransaction::Transport::Type getType ()
182+ const noexcept = 0;
182183
183184 virtual folly::AsyncTransport* getTransport () = 0;
184185
185- virtual const folly::AsyncTransport* getTransport () const = 0;
186+ [[nodiscard]] virtual const folly::AsyncTransport* getTransport () const = 0;
186187
187- virtual folly::EventBase* getEventBase () const = 0;
188+ [[nodiscard]] virtual folly::EventBase* getEventBase () const = 0;
188189
189190 /* *
190191 * Called by handleErrorDirectly (when handling parse errors) if the
@@ -193,34 +194,35 @@ class HTTPSessionBase : public wangle::ManagedConnection {
193194 HTTPTransaction::Handler* getParseErrorHandler (HTTPTransaction* txn,
194195 const HTTPException& error);
195196
196- virtual bool hasActiveTransactions () const = 0;
197+ [[nodiscard]] virtual bool hasActiveTransactions () const = 0;
197198
198199 /* *
199200 * Returns true iff a new outgoing transaction can be made on this session
200201 */
201- virtual bool supportsMoreTransactions () const {
202+ [[nodiscard]] virtual bool supportsMoreTransactions () const {
202203 return (getNumOutgoingStreams () < getMaxConcurrentOutgoingStreams ());
203204 }
204205
205- virtual uint32_t getNumStreams () const = 0;
206+ [[nodiscard]] virtual uint32_t getNumStreams () const = 0;
206207
207- virtual uint32_t getNumOutgoingStreams () const = 0;
208+ [[nodiscard]] virtual uint32_t getNumOutgoingStreams () const = 0;
208209
209210 // SimpleSessionPool
210- uint32_t getHistoricalMaxOutgoingStreams () const {
211+ [[nodiscard]] uint32_t getHistoricalMaxOutgoingStreams () const {
211212 return historicalMaxOutgoingStreams_;
212213 }
213214
214- virtual uint32_t getNumIncomingStreams () const = 0;
215+ [[nodiscard]] virtual uint32_t getNumIncomingStreams () const = 0;
215216
216- virtual uint32_t getMaxConcurrentOutgoingStreamsRemote () const = 0;
217+ [[nodiscard]] virtual uint32_t getMaxConcurrentOutgoingStreamsRemote ()
218+ const = 0;
217219
218- uint32_t getMaxConcurrentOutgoingStreams () const {
220+ [[nodiscard]] uint32_t getMaxConcurrentOutgoingStreams () const {
219221 return std::min (maxConcurrentOutgoingStreamsConfig_,
220222 getMaxConcurrentOutgoingStreamsRemote ());
221223 }
222224
223- HTTPSessionController* getController () const {
225+ [[nodiscard]] HTTPSessionController* getController () const {
224226 return controller_;
225227 }
226228
@@ -231,7 +233,7 @@ class HTTPSessionBase : public wangle::ManagedConnection {
231233 initCodecHeaderIndexingStrategy ();
232234 }
233235
234- ConnectionCloseReason getConnectionCloseReason () const {
236+ [[nodiscard]] ConnectionCloseReason getConnectionCloseReason () const {
235237 return closeReason_;
236238 }
237239
@@ -240,7 +242,7 @@ class HTTPSessionBase : public wangle::ManagedConnection {
240242 codec_.add <Filter>(std::forward<Args>(args)...);
241243 }
242244
243- virtual CodecProtocol getCodecProtocol () const {
245+ [[nodiscard]] virtual CodecProtocol getCodecProtocol () const {
244246 return codec_->getProtocol ();
245247 }
246248
@@ -271,7 +273,7 @@ class HTTPSessionBase : public wangle::ManagedConnection {
271273 h2PrioritiesEnabled_ = enabled;
272274 }
273275
274- virtual bool getHTTP2PrioritiesEnabled () const {
276+ [[nodiscard]] virtual bool getHTTP2PrioritiesEnabled () const {
275277 return h2PrioritiesEnabled_;
276278 }
277279
@@ -294,7 +296,7 @@ class HTTPSessionBase : public wangle::ManagedConnection {
294296 * Get/Set the number of egress bytes this session will buffer before
295297 * pausing all transactions' egress.
296298 */
297- uint32_t getWriteBufferLimit () const {
299+ [[nodiscard]] uint32_t getWriteBufferLimit () const {
298300 return writeBufLimit_;
299301 }
300302
@@ -338,7 +340,7 @@ class HTTPSessionBase : public wangle::ManagedConnection {
338340 return 0 ;
339341 }
340342
341- uint64_t getNumTxnServed () const {
343+ [[nodiscard]] uint64_t getNumTxnServed () const {
342344 return transactionSeqNo_;
343345 }
344346
@@ -354,13 +356,16 @@ class HTTPSessionBase : public wangle::ManagedConnection {
354356 }
355357
356358 // public HTTPTransaction::Transport overrides
357- virtual const folly::SocketAddress& getLocalAddress () const noexcept {
359+ [[nodiscard]] virtual const folly::SocketAddress& getLocalAddress ()
360+ const noexcept {
358361 return localAddr_;
359362 }
360- const folly::SocketAddress& getPeerAddress () const noexcept override {
363+ [[nodiscard]] const folly::SocketAddress& getPeerAddress ()
364+ const noexcept override {
361365 return peerAddr_;
362366 }
363- const wangle::TransportInfo& getSetupTransportInfo () const noexcept
367+ [[nodiscard]] const wangle::TransportInfo& getSetupTransportInfo ()
368+ const noexcept
364369 /* override*/ {
365370 return transportInfo_;
366371 }
@@ -424,7 +429,7 @@ class HTTPSessionBase : public wangle::ManagedConnection {
424429
425430 using FilterIteratorFn = std::function<void (HTTPCodecFilter*)>;
426431
427- virtual bool isDetachable (bool checkSocket) const = 0;
432+ [[nodiscard]] virtual bool isDetachable (bool checkSocket) const = 0;
428433
429434 virtual void attachThreadLocals (
430435 folly::EventBase* eventBase,
@@ -447,18 +452,18 @@ class HTTPSessionBase : public wangle::ManagedConnection {
447452 virtual HTTPTransaction* newTransaction (
448453 HTTPTransaction::Handler* handler) = 0;
449454
450- virtual bool isReplaySafe () const = 0;
455+ [[nodiscard]] virtual bool isReplaySafe () const = 0;
451456
452457 /* *
453458 * Returns true if the underlying transport can be used again in a new
454459 * request.
455460 */
456- virtual bool isReusable () const = 0;
461+ [[nodiscard]] virtual bool isReusable () const = 0;
457462
458463 /* *
459464 * Returns true if the session is shutting down
460465 */
461- virtual bool isClosing () const = 0;
466+ [[nodiscard]] virtual bool isClosing () const = 0;
462467
463468 /* *
464469 * Drains the current transactions and prevents new transactions from being
@@ -556,7 +561,7 @@ class HTTPSessionBase : public wangle::ManagedConnection {
556561 CHECK_EQ (codec_->getTransportDirection (), TransportDirection::DOWNSTREAM );
557562 enableServerEarlyResponse_ = codec_->supportsParallelRequests ();
558563 }
559- bool getServerEarlyResponseEnabled () const {
564+ [[nodiscard]] bool getServerEarlyResponseEnabled () const {
560565 return enableServerEarlyResponse_;
561566 }
562567
@@ -571,7 +576,7 @@ class HTTPSessionBase : public wangle::ManagedConnection {
571576 return pendingWriteSize_ + pendingWriteSizeDelta_ > 0 ;
572577 }
573578
574- uint64_t getPendingWriteSize () const {
579+ [[nodiscard]] uint64_t getPendingWriteSize () const {
575580 return pendingWriteSize_;
576581 }
577582
@@ -592,7 +597,7 @@ class HTTPSessionBase : public wangle::ManagedConnection {
592597 latestActive_ = getCurrentTime ();
593598 }
594599
595- bool ingressLimitExceeded () const {
600+ [[nodiscard]] bool ingressLimitExceeded () const {
596601 return pendingReadSize_ > readBufLimit_;
597602 }
598603 void onCreateTransaction () {
@@ -733,7 +738,7 @@ class HTTPSessionBase : public wangle::ManagedConnection {
733738 HTTPSessionController* controller_{nullptr };
734739
735740 // private ManagedConnection methods
736- std::chrono::milliseconds getIdleTime () const override {
741+ [[nodiscard]] std::chrono::milliseconds getIdleTime () const override {
737742 if (timePointInitialized (latestActive_)) {
738743 return millisecondsSince (latestActive_);
739744 } else {
0 commit comments