Skip to content

Commit b5350ff

Browse files
Matt Jorasfacebook-github-bot
Matt Joras
authored andcommitted
Remove exceptions from ConnectionId
Summary: This primarily involved making the constructors private and changing the callers of the factory functions. The crashing factory is only expected to be used by tests. Reviewed By: kvtsoy Differential Revision: D74347638 fbshipit-source-id: 4c0dd7fabaa233c8a3460c359462a22642d26f5b
1 parent b909141 commit b5350ff

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

proxygen/lib/http/session/HQSession.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,10 @@ class HQSession
239239
os << "proto=" << alpn_;
240240
auto clientCid = (sock_ && sock_->getClientConnectionId())
241241
? *sock_->getClientConnectionId()
242-
: quic::ConnectionId({0, 0, 0, 0});
242+
: quic::ConnectionId::createZeroLength();
243243
auto serverCid = (sock_ && sock_->getServerConnectionId())
244244
? *sock_->getServerConnectionId()
245-
: quic::ConnectionId({0, 0, 0, 0});
245+
: quic::ConnectionId::createZeroLength();
246246
if (direction_ == TransportDirection::DOWNSTREAM) {
247247
os << ", UA=" << userAgent_ << ", client CID=" << clientCid
248248
<< ", server CID=" << serverCid << ", downstream=" << getPeerAddress()

proxygen/lib/http/session/test/MockQuicSocketDriver.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,12 @@ class MockQuicSocketDriver : public folly::EventBase::LoopCallback {
166166
.WillRepeatedly(testing::Return(bufferAvailable_));
167167

168168
EXPECT_CALL(*sock_, getClientConnectionId())
169-
.WillRepeatedly(
170-
testing::Return(quic::ConnectionId({0x11, 0x11, 0x11, 0x11})));
169+
.WillRepeatedly(testing::Return(
170+
quic::ConnectionId::createAndMaybeCrash({0x11, 0x11, 0x11, 0x11})));
171171

172172
EXPECT_CALL(*sock_, getServerConnectionId())
173-
.WillRepeatedly(
174-
testing::Return(quic::ConnectionId({0x11, 0x11, 0x11, 0x11})));
173+
.WillRepeatedly(testing::Return(
174+
quic::ConnectionId::createAndMaybeCrash({0x11, 0x11, 0x11, 0x11})));
175175

176176
EXPECT_CALL(*sock_, getAppProtocol())
177177
.WillRepeatedly(testing::Return(alpn_));

proxygen/lib/transport/test/H3DatagramAsyncSocketTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void H3DatagramAsyncSocketTest::SetUp() {
6060
EXPECT_CALL(*socketDriver_->getSocket(), getTransportInfo())
6161
.WillRepeatedly(testing::Return(transportInfo));
6262
EXPECT_CALL(*socketDriver_->getSocket(), getClientChosenDestConnectionId())
63-
.WillRepeatedly(Return(ConnectionId::createRandom(2)));
63+
.WillRepeatedly(Return(ConnectionId::createRandom(2).value()));
6464
}
6565

6666
void H3DatagramAsyncSocketTest::TearDown() {

0 commit comments

Comments
 (0)