Skip to content

Commit efca56f

Browse files
Aman Sharmameta-codesync[bot]
authored andcommitted
Remove draft 11 parsing branch from MoQControlCodec::parseFrameLength
Summary: We're not negotiating draft 11 any more Reviewed By: sandarsh Differential Revision: D96403898 fbshipit-source-id: c11d20b3bc025428a4696b533f694e9ef813a987
1 parent 6826551 commit efca56f

4 files changed

Lines changed: 6 additions & 52 deletions

File tree

moxygen/MoQCodec.cpp

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -45,41 +45,13 @@ folly::Expected<folly::Unit, ErrorCode> MoQControlCodec::parseFrameLength(
4545
uint64_t length = 0;
4646
size_t bytesParsed = 0;
4747

48-
bool parseFrameLengthAs16bit = false;
49-
if (curFrameType_ == FrameType::CLIENT_SETUP ||
50-
curFrameType_ == FrameType::SERVER_SETUP) {
51-
parseFrameLengthAs16bit = true;
52-
} else if (
53-
curFrameType_ == FrameType::LEGACY_CLIENT_SETUP ||
54-
curFrameType_ == FrameType::LEGACY_SERVER_SETUP) {
55-
parseFrameLengthAs16bit = false;
56-
} else if (!moqFrameParser_.getVersion().has_value()) {
57-
XLOG(DBG4)
58-
<< "Received a non-setup frame before knowing the negotiated version";
59-
return folly::makeUnexpected(ErrorCode::PROTOCOL_VIOLATION);
60-
} else {
61-
parseFrameLengthAs16bit =
62-
(getDraftMajorVersion(*moqFrameParser_.getVersion()) >= 11);
63-
}
64-
65-
if (parseFrameLengthAs16bit) {
66-
if (remainingLength < 2) {
67-
XLOG(DBG6) << __func__ << " underflow";
68-
return folly::makeUnexpected(ErrorCode::PARSE_UNDERFLOW);
69-
}
70-
// Parse the length as a 16 bit integer
71-
length = cursor.readBE<uint16_t>();
72-
bytesParsed = 2;
73-
} else {
74-
// Parse the length as a varint
75-
auto decodeResult = quic::follyutils::decodeQuicInteger(cursor);
76-
if (!decodeResult) {
77-
XLOG(DBG6) << __func__ << " underflow";
78-
return folly::makeUnexpected(ErrorCode::PARSE_UNDERFLOW);
79-
}
80-
length = decodeResult->first;
81-
bytesParsed = decodeResult->second;
48+
if (remainingLength < 2) {
49+
XLOG(DBG6) << __func__ << " underflow";
50+
return folly::makeUnexpected(ErrorCode::PARSE_UNDERFLOW);
8251
}
52+
// Parse the length as a 16 bit integer
53+
length = cursor.readBE<uint16_t>();
54+
bytesParsed = 2;
8355
curFrameLength_ = length;
8456
remainingLength -= bytesParsed;
8557
parseState_ = ParseState::FRAME_PAYLOAD;
@@ -460,12 +432,6 @@ folly::Expected<folly::Unit, ErrorCode> MoQControlCodec::parseFrame(
460432
XLOG(DBG4) << "parsing frame type=" << folly::to_underlying(curFrameType_);
461433
if (!seenSetup_) {
462434
switch (curFrameType_) {
463-
case FrameType::LEGACY_CLIENT_SETUP:
464-
case FrameType::LEGACY_SERVER_SETUP:
465-
XLOG(WARN) << "Skipping unexpected legacy setup frame "
466-
<< curFrameType_;
467-
cursor.skip(curFrameLength_);
468-
break;
469435
case FrameType::CLIENT_SETUP: {
470436
if (dir_ == Direction::CLIENT) {
471437
return folly::makeUnexpected(ErrorCode::PROTOCOL_VIOLATION);
@@ -504,9 +470,7 @@ folly::Expected<folly::Unit, ErrorCode> MoQControlCodec::parseFrame(
504470
}
505471
XCHECK(seenSetup_);
506472
switch (curFrameType_) {
507-
case FrameType::LEGACY_CLIENT_SETUP:
508473
case FrameType::CLIENT_SETUP:
509-
case FrameType::LEGACY_SERVER_SETUP:
510474
case FrameType::SERVER_SETUP:
511475
XLOG(ERR) << "Duplicate setup frame";
512476
return folly::makeUnexpected(ErrorCode::PROTOCOL_VIOLATION);

moxygen/MoQCodec.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,6 @@ class MoQControlCodec : public MoQCodec {
134134
case FrameType::GOAWAY:
135135
case FrameType::CLIENT_SETUP:
136136
case FrameType::SERVER_SETUP:
137-
case FrameType::LEGACY_CLIENT_SETUP:
138-
case FrameType::LEGACY_SERVER_SETUP:
139137
case FrameType::MAX_REQUEST_ID:
140138
case FrameType::REQUESTS_BLOCKED:
141139
case FrameType::FETCH:

moxygen/MoQTypes.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ namespace {
1616

1717
const char* getFrameTypeString(moxygen::FrameType type) {
1818
switch (type) {
19-
case moxygen::FrameType::LEGACY_CLIENT_SETUP:
20-
return "LEGACY_CLIENT_SETUP";
21-
case moxygen::FrameType::LEGACY_SERVER_SETUP:
22-
return "LEGACY_SERVER_SETUP";
2319
case moxygen::FrameType::SUBSCRIBE:
2420
return "SUBSCRIBE";
2521
case moxygen::FrameType::SUBSCRIBE_OK:
@@ -267,8 +263,6 @@ const folly::F14FastMap<TrackRequestParamKey, folly::F14FastSet<FrameType>>
267263
const folly::F14FastSet<FrameType> kAllowAllParamsFrameTypes = {
268264
FrameType::CLIENT_SETUP,
269265
FrameType::SERVER_SETUP,
270-
FrameType::LEGACY_CLIENT_SETUP,
271-
FrameType::LEGACY_SERVER_SETUP,
272266
};
273267

274268
bool Parameters::isKnownParamKey(uint64_t key) {

moxygen/MoQTypes.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,6 @@ enum class FrameType : uint64_t {
180180
PUBLISH_ERROR = 0x1F,
181181
CLIENT_SETUP = 0x20,
182182
SERVER_SETUP = 0x21,
183-
LEGACY_CLIENT_SETUP = 0x40,
184-
LEGACY_SERVER_SETUP = 0x41,
185183
};
186184

187185
enum class DatagramType : uint64_t {

0 commit comments

Comments
 (0)