Skip to content

Commit 5158e48

Browse files
Robert Roeserfacebook-github-bot
Robert Roeser
authored andcommitted
seperate buffer create functions for request and payload frames
Summary: tsia; Reviewed By: praihan Differential Revision: D70032638 fbshipit-source-id: 0cd6417b2fb09a7782a46eac46cef8c4e93949a7
1 parent e9ae9a8 commit 5158e48

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

third-party/thrift/src/thrift/lib/cpp2/transport/rocket/framing/parser/AlignedParserStrategy.h

+19-1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ class AlignedParserStrategy {
109109

110110
std::unique_ptr<folly::IOBuf> createHeaderBuffer();
111111
std::unique_ptr<folly::IOBuf> createDataBuffer();
112+
std::unique_ptr<folly::IOBuf> createRequestResponseDataBuffer();
113+
std::unique_ptr<folly::IOBuf> createPayloadDataBuffer();
112114

113115
void handleAwaitingHeader(size_t len);
114116

@@ -133,10 +135,26 @@ std::unique_ptr<folly::IOBuf> AlignedParserStrategy<T>::createHeaderBuffer() {
133135
}
134136

135137
template <typename T>
136-
std::unique_ptr<folly::IOBuf> AlignedParserStrategy<T>::createDataBuffer() {
138+
std::unique_ptr<folly::IOBuf>
139+
AlignedParserStrategy<T>::createRequestResponseDataBuffer() {
140+
return folly::IOBuf::createCombined(remainingData_);
141+
}
142+
143+
template <typename T>
144+
std::unique_ptr<folly::IOBuf>
145+
AlignedParserStrategy<T>::createPayloadDataBuffer() {
137146
return folly::IOBuf::createCombined(remainingData_);
138147
}
139148

149+
template <typename T>
150+
std::unique_ptr<folly::IOBuf> AlignedParserStrategy<T>::createDataBuffer() {
151+
if (frameType_ == FrameType::PAYLOAD) {
152+
return createPayloadDataBuffer();
153+
} else {
154+
return createRequestResponseDataBuffer();
155+
}
156+
}
157+
140158
template <typename T>
141159
void AlignedParserStrategy<T>::getReadBuffer(
142160
void** bufReturn, size_t* lenReturn) {

0 commit comments

Comments
 (0)