Skip to content

Commit

Permalink
Apply clang-format 18
Browse files Browse the repository at this point in the history
Summary: Previously this code conformed from clang-format 12.

Reviewed By: igorsugak

Differential Revision: D56065247

fbshipit-source-id: f5a985dd8f8b84f2f9e1818b3719b43c5a1b05b3
  • Loading branch information
zertosh authored and facebook-github-bot committed Apr 14, 2024
1 parent b6d1b81 commit 202f3e3
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 51 deletions.
10 changes: 4 additions & 6 deletions proxygen/lib/dns/CAresResolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,9 +778,8 @@ void CAresResolver::resolveAddress(DNSResolver::ResolutionCallback* cb,
std::chrono::milliseconds timeout) {
if (timeout > kMaxTimeout) {
LOG(WARNING) << "Attempt to resolve " << address.getAddressStr()
<< " specified with "
<< "timeout of " << timeout.count() << "ms; "
<< "clamping to " << kMaxTimeout.count() << "ms";
<< " specified with " << "timeout of " << timeout.count()
<< "ms; " << "clamping to " << kMaxTimeout.count() << "ms";
timeout = kMaxTimeout;
}

Expand Down Expand Up @@ -956,9 +955,8 @@ void CAresResolver::resolveMailExchange(DNSResolver::ResolutionCallback* cb,
std::chrono::milliseconds timeout) {
if (timeout > kMaxTimeout) {
LOG(WARNING) << "Attempt to resolve mail exchange info for " << domain
<< " specified with "
<< "timeout of " << timeout.count() << "ms; "
<< "clamping to " << kMaxTimeout.count() << "ms";
<< " specified with " << "timeout of " << timeout.count()
<< "ms; " << "clamping to " << kMaxTimeout.count() << "ms";
timeout = kMaxTimeout;
}

Expand Down
2 changes: 1 addition & 1 deletion proxygen/lib/dns/DNSResolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class DNSResolver : public folly::DelayedDestruction {
/**
* Status codes for resolution failures.
*/
// clang-format off
// clang-format off
#define DNSRESOLVER_RESOLUTION_STATUS_GEN(xx) \
xx(OK, "Success") \
xx(TIMEOUT, "Timed out") \
Expand Down
9 changes: 5 additions & 4 deletions proxygen/lib/dns/test/FutureDNSResolverTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ TEST_F(FutureDNSResolverTest, TestResolveAddressSuccess) {

TEST_F(FutureDNSResolverTest, TestResolveAddressFail) {
auto addr = folly::SocketAddress(folly::IPAddress("6.7.8.9"), 0);
EXPECT_THROW({ resolver_->resolveAddress(addr).getVia(evb_); },
FakeResolverError);
EXPECT_THROW(
{ resolver_->resolveAddress(addr).getVia(evb_); }, FakeResolverError);
}

TEST_F(FutureDNSResolverTest, TestResolveHostnameSuccess) {
Expand All @@ -207,8 +207,9 @@ TEST_F(FutureDNSResolverTest, TestResolveHostnameSuccess) {
}

TEST_F(FutureDNSResolverTest, TestResolveHostnameFail) {
EXPECT_THROW({ resolver_->resolveHostname("unknown-host.com").getVia(evb_); },
FakeResolverError);
EXPECT_THROW(
{ resolver_->resolveHostname("unknown-host.com").getVia(evb_); },
FakeResolverError);
}

TEST_F(FutureDNSResolverTest, TestResolveMailExchangeSuccess) {
Expand Down
8 changes: 6 additions & 2 deletions proxygen/lib/http/HTTPHeaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -460,15 +460,19 @@ void HTTPHeaders::add(HTTPHeaderCode code, T&& value) {
#define ITERATE_OVER_STRINGS(String, Block) \
ITERATE_OVER_CODES(HTTP_HEADER_OTHER, { \
if (caseInsensitiveEqual((String), *names()[pos])) { \
{ Block } \
{ \
Block \
} \
} \
})

// iterate over the positions of all headers with given name ignoring - and _
#define ITERATE_OVER_STRINGS_ALL_VERSION(String, Block) \
ITERATE_OVER_CODES(HTTP_HEADER_OTHER, { \
if (caseUnderscoreInsensitiveEqual((String), *names()[pos])) { \
{ Block } \
{ \
Block \
} \
} \
})

Expand Down
5 changes: 2 additions & 3 deletions proxygen/lib/http/codec/DefaultHTTPCodecFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ std::unique_ptr<HTTPCodec> DefaultHTTPCodecFactory::getCodec(
} else {
if (!chosenProto.empty() &&
!HTTP1xCodec::supportsNextProtocol(chosenProto)) {
LOG(ERROR) << "Chosen upstream protocol "
<< "\"" << chosenProto << "\" is unimplemented. "
<< "Attempting to use HTTP/1.1";
LOG(ERROR) << "Chosen upstream protocol " << "\"" << chosenProto
<< "\" is unimplemented. " << "Attempting to use HTTP/1.1";
}

return std::make_unique<HTTP1xCodec>(
Expand Down
5 changes: 2 additions & 3 deletions proxygen/lib/http/codec/HTTP1xCodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1152,9 +1152,8 @@ int HTTP1xCodec::onHeadersComplete(size_t len) {
const std::string& accept =
hdrs.getSingleOrEmpty(HTTP_HEADER_SEC_WEBSOCKET_ACCEPT);
if (accept != websockAcceptKey_) {
LOG(ERROR) << "Mismatch in expected ws accept key: "
<< "upstream: " << accept
<< " expected: " << websockAcceptKey_;
LOG(ERROR) << "Mismatch in expected ws accept key: " << "upstream: "
<< accept << " expected: " << websockAcceptKey_;
return -1;
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion proxygen/lib/http/connpool/test/SessionPoolTestFixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class SessionPoolFixture
void onBody(std::unique_ptr<folly::IOBuf> /*chain*/) noexcept override {
}
void onChunkHeader(size_t /*length*/) noexcept override{};
void onChunkComplete() noexcept override{};
void onChunkComplete() noexcept override {};
void onTrailers(std::unique_ptr<HTTPHeaders> /*trailers*/) noexcept override {
}
void onEOM() noexcept override {
Expand Down
2 changes: 1 addition & 1 deletion proxygen/lib/http/session/HQDownstreamSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class HQDownstreamSession : public HQSession {

private:
hq::PushId pushId_; // The push id in context of which this stream is sent
}; // HQEgressPushStream
}; // HQEgressPushStream
#ifdef _MSC_VER
#pragma warning(pop)
#endif
Expand Down
9 changes: 4 additions & 5 deletions proxygen/lib/http/session/HQSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ void HQSession::onStopSending(quic::StreamId id,
void HQSession::onKnob(uint64_t knobSpace,
uint64_t knobId,
quic::Buf knobBlob) {
VLOG(3) << __func__ << " sess=" << *this << " knob frame received: "
<< " KnobSpace: " << std::hex << knobSpace << " KnobId: " << knobId
<< " KnobBlob: "
VLOG(3) << __func__ << " sess=" << *this
<< " knob frame received: " << " KnobSpace: " << std::hex << knobSpace
<< " KnobId: " << knobId << " KnobBlob: "
<< std::string(reinterpret_cast<const char*>(knobBlob->data()),
knobBlob->length());
}
Expand Down Expand Up @@ -1157,8 +1157,7 @@ void HQSession::readAvailable(quic::StreamId id) noexcept {
<< ": readAvailable on streamID=" << id;
if (readsPerLoop_ >= kMaxReadsPerLoop) {
VLOG(2) << __func__ << ": skipping read for streamID=" << id
<< " maximum reads per loop reached"
<< " sess=" << *this;
<< " maximum reads per loop reached" << " sess=" << *this;
return;
}
readsPerLoop_++;
Expand Down
7 changes: 3 additions & 4 deletions proxygen/lib/http/session/HQUpstreamSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,8 @@ class HQUpstreamSession : public HQSession {
void onPushMessageBegin(HTTPCodec::StreamID pushId,
HTTPCodec::StreamID parentTxnId,
HTTPMessage* /* msg */) override {
LOG(ERROR) << "Push promise on push stream"
<< " txn=" << txn_ << " pushID=" << pushId
<< " parentTxnId=" << parentTxnId;
LOG(ERROR) << "Push promise on push stream" << " txn=" << txn_
<< " pushID=" << pushId << " parentTxnId=" << parentTxnId;
session_.dropConnectionAsync(
quic::QuicError(HTTP3::ErrorCode::HTTP_FRAME_UNEXPECTED,
"Push promise on push stream"),
Expand Down Expand Up @@ -193,7 +192,7 @@ class HQUpstreamSession : public HQSession {
private:
hq::PushId pushId_; // The push id in context of which this stream is
// received
}; // HQIngressPushStream
}; // HQIngressPushStream

#ifdef _MSC_VER
#pragma warning(pop)
Expand Down
7 changes: 3 additions & 4 deletions proxygen/lib/http/session/HTTPTransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1499,10 +1499,9 @@ void HTTPTransaction::sendEOM() {
<< "ingressState=" << ingressState_ << ", "
<< "egressPaused=" << egressPaused_ << ", "
<< "ingressPaused=" << ingressPaused_ << ", "
<< "aborted=" << aborted_ << ", "
<< "enqueued=" << isEnqueued() << ", "
<< "chainLength=" << deferredEgressBody_.chainLength() << ", "
<< "bufferMetaLen=" << deferredBufferMeta_.length << "]"
<< "aborted=" << aborted_ << ", " << "enqueued=" << isEnqueued()
<< ", " << "chainLength=" << deferredEgressBody_.chainLength()
<< ", " << "bufferMetaLen=" << deferredBufferMeta_.length << "]"
<< " on " << *this;
}
} else {
Expand Down
8 changes: 4 additions & 4 deletions proxygen/lib/http/session/test/MockHTTPSessionStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ namespace proxygen {

class DummyHTTPSessionStats : public HTTPSessionStats {
public:
void recordTransactionOpened() noexcept override{};
void recordTransactionClosed() noexcept override{};
void recordTransactionOpened() noexcept override {};
void recordTransactionClosed() noexcept override {};
void recordTransactionsServed(uint64_t) noexcept override{};
void recordSessionReused() noexcept override{};
void recordSessionReused() noexcept override {};
// virtual void recordSessionIdleTime(std::chrono::seconds) noexcept {};
void recordTransactionStalled() noexcept override{};
void recordTransactionStalled() noexcept override {};
void recordSessionStalled() noexcept override {
}
void recordEgressContentLengthMismatches() noexcept override {
Expand Down
18 changes: 9 additions & 9 deletions proxygen/lib/http/session/test/MockQuicSocketDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ class MockQuicSocketDriver : public folly::EventBase::LoopCallback {
fmt::format("write callback not set when calling "
"onConnectionWriteReady for streamId={}",
id),
return );
return);
auto maxStreamToWrite = maxStreamWritable(id);
auto maxConnToWrite = maxConnWritable();
if (!maxConnToWrite && !maxStreamToWrite) {
Expand Down Expand Up @@ -1388,7 +1388,7 @@ class MockQuicSocketDriver : public folly::EventBase::LoopCallback {
events_.emplace_back(std::move(cob));
eventBase_->runAfterDelay(
[this] {
ERROR_IF(events_.empty(), "no events to schedule", return );
ERROR_IF(events_.empty(), "no events to schedule", return);
auto event = std::move(events_.front());
events_.pop_front();
event();
Expand Down Expand Up @@ -1458,7 +1458,7 @@ class MockQuicSocketDriver : public folly::EventBase::LoopCallback {
std::chrono::milliseconds(0)) {
ERROR_IF(streams_[kConnectionStreamId].readState == CLOSED,
"adding read event on CLOSED connection",
return );
return);
cumulativeDelay_ += delayFromPrevious;
runInThisLoopOrAfterDelay(
[events = std::move(events), this, deleted = deleted_]() mutable {
Expand All @@ -1482,13 +1482,13 @@ class MockQuicSocketDriver : public folly::EventBase::LoopCallback {
ERROR_IF(stream.readState == CLOSED,
fmt::format("scheduling event on CLOSED streamId={}",
event.streamId),
return );
return);
} else {
ERROR_IF((event.buf && !event.buf->empty()) || event.eof,
fmt::format("scheduling an error event with either a "
"buffer or eof on streamId={}",
event.streamId),
return );
return);
}
if (event.streamId == kConnectionStreamId &&
event.datagramsAvailable && !event.error && datagramCB_) {
Expand Down Expand Up @@ -1595,7 +1595,7 @@ class MockQuicSocketDriver : public folly::EventBase::LoopCallback {
auto& connStream = streams_[kConnectionStreamId];
ERROR_IF(connStream.writeState == CLOSED,
"setConnectionFlowControlWindow on CLOSED connection",
return );
return);
connStream.flowControlWindow = windowSize;
if (pauseOrResumeWrites(connStream, kConnectionStreamId) ==
PauseResumeResult::RESUMED) {
Expand All @@ -1619,7 +1619,7 @@ class MockQuicSocketDriver : public folly::EventBase::LoopCallback {

ERROR_IF(stream.writeState == CLOSED,
"setStreamFlowControlWindow on CLOSED connection",
return );
return);
stream.flowControlWindow = windowSize;
pauseOrResumeWrites(stream, streamId);
}
Expand All @@ -1628,7 +1628,7 @@ class MockQuicSocketDriver : public folly::EventBase::LoopCallback {
auto& stream = streams_[streamId];
ERROR_IF(stream.writeState != OPEN,
fmt::format("pauseWrites on not OPEN streamId={}", streamId),
return );
return);
stream.writeState = PAUSED;
}

Expand All @@ -1645,7 +1645,7 @@ class MockQuicSocketDriver : public folly::EventBase::LoopCallback {
auto& stream = streams_[streamId];
ERROR_IF(stream.writeState != PAUSED && !connFCEvent,
fmt::format("resumeWrites on not PAUSED streamId={}", streamId),
return );
return);
stream.writeState = OPEN;
// first flush any buffered writes
flushWrites(streamId);
Expand Down
4 changes: 2 additions & 2 deletions proxygen/lib/http/test/MockHTTPHeaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ class HasHTTPHeaderMatcherImpl
if (!value_) {
*os << "does not have the '" << name_ << "' header";
} else {
*os << "does not have the '" << name_ << "' header "
<< "equal to '" << *value_ << "'";
*os << "does not have the '" << name_ << "' header " << "equal to '"
<< *value_ << "'";
}
}

Expand Down
3 changes: 1 addition & 2 deletions proxygen/lib/utils/URL.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ class URL {
uint16_t port = 0,
const std::string& path = "",
const std::string& query = "",
const std::string& fragment = "")
noexcept
const std::string& fragment = "") noexcept
: host_(host),
port_(port),
path_(path),
Expand Down

0 comments on commit 202f3e3

Please sign in to comment.