Skip to content

Commit 0b95f94

Browse files
generatedunixname1587093422349604meta-codesync[bot]
authored andcommitted
Fix CQS signal modernize-use-nodiscard in fbcode/proxygen/lib
Differential Revision: D92809129 fbshipit-source-id: c1ca7e6cc9d9c902f556f7d8cbbf25a0b4a1a674
1 parent e4efbe5 commit 0b95f94

6 files changed

Lines changed: 60 additions & 49 deletions

File tree

third-party/proxygen/src/proxygen/lib/http/session/HTTPSession.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ class HTTPSession
980980
session_->flowControlTimeoutExpired();
981981
}
982982

983-
std::chrono::milliseconds getTimeoutDuration() const {
983+
[[nodiscard]] std::chrono::milliseconds getTimeoutDuration() const {
984984
return duration_;
985985
}
986986

third-party/proxygen/src/proxygen/lib/http/session/HTTPSessionAcceptor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class HTTPSessionAcceptor
4646
/**
4747
* Access the default error page generator.
4848
*/
49-
const HTTPErrorPage* getDefaultErrorPage() const {
49+
[[nodiscard]] const HTTPErrorPage* getDefaultErrorPage() const {
5050
return defaultErrorPage_.get();
5151
}
5252

third-party/proxygen/src/proxygen/lib/http/session/HTTPSessionBase.h

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -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 {

third-party/proxygen/src/proxygen/lib/http/session/HTTPSessionController.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,24 @@ class HTTPSessionController {
9191
/**
9292
* Optionally allow the session to query custom graceful shutdown timeout.
9393
*/
94-
virtual std::chrono::milliseconds getGracefulShutdownTimeout() const {
94+
[[nodiscard]] virtual std::chrono::milliseconds getGracefulShutdownTimeout()
95+
const {
9596
return std::chrono::milliseconds(0);
9697
}
9798

9899
/**
99100
* Optionally allow the session to query custom flow control timeout.
100101
*/
101-
virtual std::chrono::milliseconds getSessionFlowControlTimeout() const {
102+
[[nodiscard]] virtual std::chrono::milliseconds getSessionFlowControlTimeout()
103+
const {
102104
return std::chrono::milliseconds(0);
103105
}
104106

105107
/**
106108
* Returns the H2 header indexing strategy to be employed by the session
107109
*/
108-
virtual const HeaderIndexingStrategy* getHeaderIndexingStrategy() const {
110+
[[nodiscard]] virtual const HeaderIndexingStrategy*
111+
getHeaderIndexingStrategy() const {
109112
return HeaderIndexingStrategy::getDefaultInstance();
110113
}
111114
};

third-party/proxygen/src/proxygen/lib/http/session/HTTPTransaction.h

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -499,25 +499,27 @@ class HTTPTransaction
499499

500500
virtual void notifyEgressBodyBuffered(int64_t bytes) noexcept = 0;
501501

502-
const folly::SocketAddress& getLocalAddress() const noexcept override = 0;
502+
[[nodiscard]] const folly::SocketAddress& getLocalAddress()
503+
const noexcept override = 0;
503504

504-
const folly::SocketAddress& getPeerAddress() const noexcept override = 0;
505+
[[nodiscard]] const folly::SocketAddress& getPeerAddress()
506+
const noexcept override = 0;
505507

506508
[[nodiscard]] virtual std::chrono::seconds getLatestIdleTime() const = 0;
507509

508510
virtual void describe(std::ostream&) const = 0;
509511

510-
virtual const wangle::TransportInfo& getSetupTransportInfo()
512+
[[nodiscard]] virtual const wangle::TransportInfo& getSetupTransportInfo()
511513
const noexcept = 0;
512514

513515
virtual bool getCurrentTransportInfo(wangle::TransportInfo* tinfo) = 0;
514516

515517
virtual void getFlowControlInfo(FlowControlInfo* info) = 0;
516518

517-
virtual HTTPTransaction::Transport::Type getSessionType()
519+
[[nodiscard]] virtual HTTPTransaction::Transport::Type getSessionType()
518520
const noexcept = 0;
519521

520-
virtual const HTTPCodec& getCodec() const noexcept = 0;
522+
[[nodiscard]] virtual const HTTPCodec& getCodec() const noexcept = 0;
521523

522524
/*
523525
* Drain the underlying session. This will affect other transactions
@@ -526,33 +528,33 @@ class HTTPTransaction
526528
*/
527529
virtual void drain() = 0;
528530

529-
virtual bool isDraining() const = 0;
531+
[[nodiscard]] virtual bool isDraining() const = 0;
530532

531533
virtual HTTPTransaction* newPushedTransaction(
532534
HTTPCodec::StreamID assocStreamId,
533535
HTTPTransaction::PushHandler* handler,
534536
ProxygenError* error = nullptr) noexcept = 0;
535537

536-
virtual std::string getSecurityProtocol() const = 0;
538+
[[nodiscard]] virtual std::string getSecurityProtocol() const = 0;
537539

538540
virtual void addWaitingForReplaySafety(
539541
folly::AsyncTransport::ReplaySafetyCallback* callback) noexcept = 0;
540542

541543
virtual void removeWaitingForReplaySafety(
542544
folly::AsyncTransport::ReplaySafetyCallback* callback) noexcept = 0;
543545

544-
virtual bool needToBlockForReplaySafety() const = 0;
546+
[[nodiscard]] virtual bool needToBlockForReplaySafety() const = 0;
545547

546-
virtual const folly::AsyncTransport* getUnderlyingTransport()
548+
[[nodiscard]] virtual const folly::AsyncTransport* getUnderlyingTransport()
547549
const noexcept = 0;
548550

549551
/**
550552
* Returns true if the underlying transport has completed full handshake.
551553
*/
552-
virtual bool isReplaySafe() const = 0;
554+
[[nodiscard]] virtual bool isReplaySafe() const = 0;
553555

554556
virtual void setHTTP2PrioritiesEnabled(bool enabled) = 0;
555-
virtual bool getHTTP2PrioritiesEnabled() const = 0;
557+
[[nodiscard]] virtual bool getHTTP2PrioritiesEnabled() const = 0;
556558

557559
virtual HTTPSessionBase* getHTTPSessionBase() = 0;
558560

@@ -563,7 +565,7 @@ class HTTPTransaction
563565
return folly::none;
564566
}
565567

566-
virtual uint16_t getDatagramSizeLimit() const noexcept {
568+
[[nodiscard]] virtual uint16_t getDatagramSizeLimit() const noexcept {
567569
return 0;
568570
}
569571

@@ -701,10 +703,10 @@ class HTTPTransaction
701703
folly::assume_unreachable();
702704
}
703705

704-
virtual folly::Optional<HTTPTransaction::ConnectionToken>
706+
[[nodiscard]] virtual folly::Optional<HTTPTransaction::ConnectionToken>
705707
getConnectionToken() const noexcept = 0;
706708

707-
virtual bool serverEarlyResponseEnabled() const noexcept {
709+
[[nodiscard]] virtual bool serverEarlyResponseEnabled() const noexcept {
708710
return false;
709711
}
710712
};

third-party/proxygen/src/proxygen/lib/http/session/SimpleController.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ class SimpleController : public HTTPSessionController {
5252
void attachSession(HTTPSessionBase*) override;
5353
void detachSession(const HTTPSessionBase*) override;
5454

55-
std::chrono::milliseconds getGracefulShutdownTimeout() const override;
55+
[[nodiscard]] std::chrono::milliseconds getGracefulShutdownTimeout()
56+
const override;
5657

5758
protected:
5859
HTTPTransactionHandler* createErrorHandler(uint32_t statusCode,

0 commit comments

Comments
 (0)