<pre style='margin:0'>
Christopher Nielsen (mascguy) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/8e4d12c840f0c47c27b16b1ca3704c4826e6c7a4">https://github.com/macports/macports-ports/commit/8e4d12c840f0c47c27b16b1ca3704c4826e6c7a4</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 8e4d12c840f0c47c27b16b1ca3704c4826e6c7a4
</span>Author: barracuda156 <vital.had@gmail.com>
AuthorDate: Wed May 17 20:43:40 2023 +0800
<span style='display:block; white-space:pre;color:#404040;'> fbthrift: revert breaking changes for <= 10.15
</span>---
devel/fbthrift/Portfile | 11 +
...te-methods-to-dcheck-ToSend-Received-OrEm.patch | 27 ++
...request-telemetry-5-x-Implement-writeStar.patch | 360 ++++++++++++++++
...act-FDs-from-otherMetadata-when-pack-make.patch | 476 +++++++++++++++++++++
...AsyncFdSocket-when-accepting-Unix-socket-.patch | 77 ++++
5 files changed, 951 insertions(+)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/devel/fbthrift/Portfile b/devel/fbthrift/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 0e1d99de20a..09d3998e8e8 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/devel/fbthrift/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/devel/fbthrift/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -40,6 +40,17 @@ depends_lib-append port:fizz \
</span>
patchfiles patch-cpp2.diff
<span style='display:block; white-space:pre;background:#e0ffe0;'>+# Keep until breaking changes in Folly are fixed:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+platform darwin {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {${os.major} < 20} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ patchfiles-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 0001-Revert-Update-methods-to-dcheck-ToSend-Received-OrEm.patch \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 0002-Revert-Per-request-telemetry-5-x-Implement-writeStar.patch \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 0003-Revert-Extract-FDs-from-otherMetadata-when-pack-make.patch \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 0004-Revert-Use-AsyncFdSocket-when-accepting-Unix-socket-.patch
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> # Fix error: invalid output constraint '=@ccc' in asm
compiler.blacklist-append \
{clang < 1200}
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/devel/fbthrift/files/0001-Revert-Update-methods-to-dcheck-ToSend-Received-OrEm.patch b/devel/fbthrift/files/0001-Revert-Update-methods-to-dcheck-ToSend-Received-OrEm.patch
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..e0c1f8095f6
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/devel/fbthrift/files/0001-Revert-Update-methods-to-dcheck-ToSend-Received-OrEm.patch
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,27 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+From 54be3719e26d21758a4e2a2199f42124419c91f6 Mon Sep 17 00:00:00 2001
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+From: barracuda156 <vital.had@gmail.com>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Date: Wed, 17 May 2023 16:16:44 +0800
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Subject: [PATCH 1/4] Revert "Update methods to
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ `dcheck{ToSend,Received}OrEmpty()`"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+This reverts commit df79893d4b66e97e9778df8aeea4f712e09a780f.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+---
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ thrift/lib/cpp2/transport/rocket/PayloadUtils.h | 2 +-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 1 file changed, 1 insertion(+), 1 deletion(-)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git thrift/lib/cpp2/transport/rocket/PayloadUtils.h thrift/lib/cpp2/transport/rocket/PayloadUtils.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index 9cc7c21cd0..6751a2b351 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- thrift/lib/cpp2/transport/rocket/PayloadUtils.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ thrift/lib/cpp2/transport/rocket/PayloadUtils.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -187,7 +187,7 @@ rocket::Payload packWithFds(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ auto ret = apache::thrift::rocket::detail::makePayload(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *metadata, std::move(serializedPayload));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (numFds) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- ret.fds = std::move(fds.dcheckToSendOrEmpty());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ ret.fds = std::move(fds.dcheckToSend());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return ret;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+2.40.1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/devel/fbthrift/files/0002-Revert-Per-request-telemetry-5-x-Implement-writeStar.patch b/devel/fbthrift/files/0002-Revert-Per-request-telemetry-5-x-Implement-writeStar.patch
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..44aee0da92c
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/devel/fbthrift/files/0002-Revert-Per-request-telemetry-5-x-Implement-writeStar.patch
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,360 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+From bbd9e317ffc9d990ea281aacac36cb495d5dcb66 Mon Sep 17 00:00:00 2001
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+From: barracuda156 <vital.had@gmail.com>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Date: Wed, 17 May 2023 16:17:12 +0800
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Subject: [PATCH 2/4] Revert "Per-request telemetry (5/x): Implement
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ writeStarting() and add raw byte offset to write events"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+This reverts commit 8e2d236c882857c0e42bd2a403f7660bb3fcf349.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+---
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .../rocket/server/RocketServerConnection.cpp | 33 +++----
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .../rocket/server/RocketServerConnection.h | 5 +-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .../server/RocketServerConnectionObserver.h | 12 +--
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .../transport/rocket/test/network/Mocks.h | 6 +-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .../rocket/test/network/RocketNetworkTest.cpp | 87 ++++++-------------
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 5 files changed, 41 insertions(+), 102 deletions(-)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git thrift/lib/cpp2/transport/rocket/server/RocketServerConnection.cpp thrift/lib/cpp2/transport/rocket/server/RocketServerConnection.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index 438c25d3c5..966fbaa0ed 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- thrift/lib/cpp2/transport/rocket/server/RocketServerConnection.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ thrift/lib/cpp2/transport/rocket/server/RocketServerConnection.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -155,6 +155,16 @@ void RocketServerConnection::flushWrites(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DestructorGuard dg(this);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DVLOG(10) << fmt::format("write: {} B", writes->computeChainDataLength());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (auto observerContainer = getObserverContainer();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ observerContainer && observerContainer->numObservers()) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ for (const auto& writeEvent : context.writeEvents) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ observerContainer->invokeInterfaceMethodAllObservers(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ [&](auto observer, auto observed) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ observer->writeReady(observed, writeEvent);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ });
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ inflightWritesQueue_.push_back(std::move(context));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ socket_->writeChain(this, std::move(writes));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -736,24 +746,6 @@ void RocketServerConnection::closeWhenIdle() {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ "Closing due to imminent shutdown"));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-void RocketServerConnection::writeStarting() noexcept {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- DestructorGuard dg(this);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- DCHECK(!inflightWritesQueue_.empty());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- auto& context = inflightWritesQueue_.front();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- DCHECK(!context.writeEventsContext.startRawByteOffset.has_value());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- context.writeEventsContext.startRawByteOffset = socket_->getRawBytesWritten();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- if (auto observerContainer = getObserverContainer();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- observerContainer && observerContainer->numObservers()) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- for (const auto& writeEvent : context.writeEvents) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- observerContainer->invokeInterfaceMethodAllObservers(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- [&](auto observer, auto observed) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- observer->writeStarting(observed, writeEvent);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- });
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ void RocketServerConnection::writeSuccess() noexcept {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DestructorGuard dg(this);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DCHECK(!inflightWritesQueue_.empty());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -763,16 +755,13 @@ void RocketServerConnection::writeSuccess() noexcept {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ --processingCompleteCount) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ frameHandler_->requestComplete();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- DCHECK(!context.writeEventsContext.endRawByteOffset.has_value());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- context.writeEventsContext.endRawByteOffset = socket_->getRawBytesWritten();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (auto observerContainer = getObserverContainer();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ observerContainer && observerContainer->numObservers()) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ for (const auto& writeEvent : context.writeEvents) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ observerContainer->invokeInterfaceMethodAllObservers(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ [&](auto observer, auto observed) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- observer->writeSuccess(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- observed, writeEvent, context.writeEventsContext);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ observer->writeSuccess(observed, writeEvent);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ });
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git thrift/lib/cpp2/transport/rocket/server/RocketServerConnection.h thrift/lib/cpp2/transport/rocket/server/RocketServerConnection.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index 68e9240c98..7fc092bc48 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- thrift/lib/cpp2/transport/rocket/server/RocketServerConnection.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ thrift/lib/cpp2/transport/rocket/server/RocketServerConnection.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -118,7 +118,6 @@ class RocketServerConnection final
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ void close(folly::exception_wrapper ew);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ // AsyncTransport::WriteCallback implementation
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- void writeStarting() noexcept final;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ void writeSuccess() noexcept final;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ void writeErr(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ size_t bytesWritten,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -299,7 +298,7 @@ class RocketServerConnection final
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * @return Attached observers of type T.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ template <typename T = Observer>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- std::vector<T*> findObservers() const {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ std::vector<T*> findObservers() {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (auto list = getObserverContainer()) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return list->findObservers<T>();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -353,8 +352,6 @@ class RocketServerConnection final
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ std::vector<apache::thrift::MessageChannel::SendCallbackPtr> sendCallbacks;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ // the WriteEvent objects associated with each write in the batch
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ std::vector<RocketServerConnectionObserver::WriteEvent> writeEvents;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- // the raw byte offset at the beginning and end of the inflight write
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- RocketServerConnectionObserver::WriteEventBatchContext writeEventsContext;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ };
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ // The size of the queue is equal to the total number of inflight writes to
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ // the underlying transport, i.e., writes for which the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git thrift/lib/cpp2/transport/rocket/server/RocketServerConnectionObserver.h thrift/lib/cpp2/transport/rocket/server/RocketServerConnectionObserver.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index eee8bde872..19bd9aad13 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- thrift/lib/cpp2/transport/rocket/server/RocketServerConnectionObserver.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ thrift/lib/cpp2/transport/rocket/server/RocketServerConnectionObserver.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -31,13 +31,6 @@ class RocketServerConnectionObserver {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ WriteEvents = 1,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ };
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- struct WriteEventBatchContext {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- // the raw byte offset at the beginning of the batch of writes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- folly::Optional<size_t> startRawByteOffset;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- // the raw byte offset at the end of the batch of writes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- folly::Optional<size_t> endRawByteOffset;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- };
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ struct WriteEvent {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ // the stream id of the write
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const StreamId streamId;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -60,7 +53,7 @@ class RocketServerConnectionObserver {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * writeReady() is invoked when a new response is ready to be written to
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * the underlying transport
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- virtual void writeStarting(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ virtual void writeReady(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ RocketServerConnection* /* connection */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const WriteEvent& /* writeEvent */) {}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -70,8 +63,7 @@ class RocketServerConnectionObserver {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ virtual void writeSuccess(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ RocketServerConnection* /* connection */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- const WriteEvent& /* writeEvent */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- const WriteEventBatchContext& /* writeEventBatchContext */) {}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const WriteEvent& /* writeEvent */) {}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ };
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } // namespace rocket
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git thrift/lib/cpp2/transport/rocket/test/network/Mocks.h thrift/lib/cpp2/transport/rocket/test/network/Mocks.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index dd1d87f3f0..be0e999ef8 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- thrift/lib/cpp2/transport/rocket/test/network/Mocks.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ thrift/lib/cpp2/transport/rocket/test/network/Mocks.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -31,15 +31,13 @@ class MockRocketServerConnectionObserver
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ using RocketServerConnection::ManagedObserver::ManagedObserver;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ MOCK_METHOD(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ void,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- writeStarting,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ writeReady,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ (RocketServerConnection*, const WriteEvent&),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ (override));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ MOCK_METHOD(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ void,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ writeSuccess,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- (RocketServerConnection*,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- const WriteEvent&,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- const WriteEventBatchContext&),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ (RocketServerConnection*, const WriteEvent&),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ (override));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ };
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git thrift/lib/cpp2/transport/rocket/test/network/RocketNetworkTest.cpp thrift/lib/cpp2/transport/rocket/test/network/RocketNetworkTest.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index a220506a77..a405f09af8 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- thrift/lib/cpp2/transport/rocket/test/network/RocketNetworkTest.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ thrift/lib/cpp2/transport/rocket/test/network/RocketNetworkTest.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1397,25 +1397,12 @@ TEST_F(RocketNetworkTest, ObserverIsNotInstalledWhenFlagIsFalse) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ });
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-MATCHER_P3(WriteStartingMatcher, id, bytes, offset, "") {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++MATCHER_P3(WriteEventMatcher, id, bytes, offset, "") {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return arg.streamId == StreamId(id) &&
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ arg.totalBytesInWrite == (size_t)bytes &&
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ arg.batchOffset == (size_t)offset;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-MATCHER_P3(WriteSuccessMatcher, id, bytes, offset, "") {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- return arg.streamId == StreamId(id) &&
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- arg.totalBytesInWrite == (size_t)bytes &&
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- arg.batchOffset == (size_t)offset;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-MATCHER_P2(WriteEventContextMatcher, startRawOffset, endRawOffset, "") {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- return arg.startRawByteOffset.has_value() &&
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- arg.startRawByteOffset.value() == startRawOffset &&
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- arg.endRawByteOffset.has_value() &&
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- arg.endRawByteOffset.value() == endRawOffset;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ TEST_F(RocketNetworkTest, ObserverIsNotifiedOnWriteSuccessRequestResponse) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ THRIFT_FLAG_SET_MOCK(enable_rocket_connection_observers, true);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ this->withClient([&](RocketTestClient& client) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1443,21 +1430,19 @@ TEST_F(RocketNetworkTest, ObserverIsNotifiedOnWriteSuccessRequestResponse) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ constexpr size_t kSetupFrameSize(14);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ constexpr size_t kSetupFrameStreamId(0);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- // send a request and check the event notifications when the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- // response is ready and written to the socket
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ // send a request and check the event notifications when the response is
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ // ready and written to the socket
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ constexpr folly::StringPiece kMetadata("metadata");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ constexpr folly::StringPiece kData("data");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- const unsigned int startOffsetBatch1 = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- const unsigned int endOffsetBatch1 = kSetupFrameSize + 24;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- // responses to setup frame (stream id = 0) and to the first
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- // request (stream id = 1) are batched together
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ // responses to setup frame (stream id = 0) and to the first request
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ // (stream id = 1) are batched together
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ EXPECT_CALL(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *observer,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- writeStarting(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ writeReady(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- WriteStartingMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ WriteEventMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ kSetupFrameStreamId /* streamId */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ kSetupFrameSize /* totalBytesWritten */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 0 /* batchOffset */)));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1465,18 +1450,15 @@ TEST_F(RocketNetworkTest, ObserverIsNotifiedOnWriteSuccessRequestResponse) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *observer,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ writeSuccess(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- WriteSuccessMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ WriteEventMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ kSetupFrameStreamId /* streamId */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ kSetupFrameSize /* totalBytesWritten */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- 0 /* batchOffset */),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- WriteEventContextMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- startOffsetBatch1 /* startRawByteOffset */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- endOffsetBatch1 /* endRawByteOffset */)));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ 0 /* batchOffset */)));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ EXPECT_CALL(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *observer,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- writeStarting(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ writeReady(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- WriteStartingMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ WriteEventMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ kSetupFrameStreamId + 1 /* streamId */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 24 /* totalBytesWritten */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ kSetupFrameSize /* batchOffset */)));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1484,13 +1466,10 @@ TEST_F(RocketNetworkTest, ObserverIsNotifiedOnWriteSuccessRequestResponse) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *observer,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ writeSuccess(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- WriteSuccessMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ WriteEventMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ kSetupFrameStreamId + 1 /* streamId */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 24 /* totalBytesWritten */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- kSetupFrameSize /* batchOffset */),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- WriteEventContextMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- startOffsetBatch1 /* startRawByteOffset */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- endOffsetBatch1 /* endRawByteOffset */)));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ kSetupFrameSize /* batchOffset */)));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ client.sendRequestResponseSync(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Payload::makeFromMetadataAndData(kMetadata, kData),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1503,16 +1482,11 @@ TEST_F(RocketNetworkTest, ObserverIsNotifiedOnWriteSuccessRequestResponse) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ constexpr folly::StringPiece kNewMetadata("new_metadata");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ constexpr folly::StringPiece kNewData("new_data");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- const unsigned int startOffsetBatch2 =
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- kSetupFrameSize + 24 /* 24 is the size of the first response */;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- const unsigned int endOffsetBatch2 =
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- startOffsetBatch2 + 32 /* 32 is the size of the second response */;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ EXPECT_CALL(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *observer,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- writeStarting(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ writeReady(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- WriteStartingMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ WriteEventMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ kSetupFrameStreamId + 3 /* streamId */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 32 /* totalBytesWritten */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 0 /* batchOffset */)));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1520,13 +1494,10 @@ TEST_F(RocketNetworkTest, ObserverIsNotifiedOnWriteSuccessRequestResponse) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *observer,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ writeSuccess(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- WriteSuccessMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ WriteEventMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ kSetupFrameStreamId + 3 /* streamId */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 32 /* totalBytesWritten */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- 0 /* batchOffset */),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- WriteEventContextMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- startOffsetBatch2 /* startRawByteOffset */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- endOffsetBatch2 /* endRawByteOffset */)));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ 0 /* batchOffset */)));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ client.sendRequestResponseSync(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Payload::makeFromMetadataAndData(kNewMetadata, kNewData),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1575,14 +1546,12 @@ TEST_F(RocketNetworkTest, ObserverIsNotifiedOnWriteSuccessRequestStream) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ constexpr folly::StringPiece kMetadata("metadata");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const auto data =
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ folly::to<std::string>("generate:", kNumRequestedPayloads);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- const unsigned int startOffsetBatch = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- const unsigned int endOffsetBatch = kSetupFrameSize + 16;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ EXPECT_CALL(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *observer,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- writeStarting(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ writeReady(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- WriteStartingMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ WriteEventMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ kSetupFrameStreamId /* streamId */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ kSetupFrameSize /* totalBytesWritten */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 0 /* batchOffset */)));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1590,18 +1559,15 @@ TEST_F(RocketNetworkTest, ObserverIsNotifiedOnWriteSuccessRequestStream) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *observer,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ writeSuccess(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- WriteSuccessMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ WriteEventMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ kSetupFrameStreamId /* streamId */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ kSetupFrameSize /* totalBytesWritten */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- 0 /* batchOffset */),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- WriteEventContextMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- startOffsetBatch /* startRawByteOffset */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- endOffsetBatch /* endRawByteOffset */)));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ 0 /* batchOffset */)));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ EXPECT_CALL(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *observer,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- writeStarting(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ writeReady(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- WriteStartingMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ WriteEventMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ kSetupFrameStreamId + 1 /* streamId */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 16 /* totalBytesWritten */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ kSetupFrameSize /* batchOffset */)));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1609,13 +1575,10 @@ TEST_F(RocketNetworkTest, ObserverIsNotifiedOnWriteSuccessRequestStream) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *observer,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ writeSuccess(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ _,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- WriteSuccessMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ WriteEventMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ kSetupFrameStreamId + 1 /* streamId */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 16 /* totalBytesWritten */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- kSetupFrameSize /* batchOffset */),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- WriteEventContextMatcher(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- startOffsetBatch /* startRawByteOffset */,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- endOffsetBatch /* endRawByteOffset */)));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ kSetupFrameSize /* batchOffset */)));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ auto stream = client.sendRequestStreamSync(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Payload::makeFromMetadataAndData(kMetadata, folly::StringPiece{data}));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+2.40.1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/devel/fbthrift/files/0003-Revert-Extract-FDs-from-otherMetadata-when-pack-make.patch b/devel/fbthrift/files/0003-Revert-Extract-FDs-from-otherMetadata-when-pack-make.patch
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..e73890a98cf
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/devel/fbthrift/files/0003-Revert-Extract-FDs-from-otherMetadata-when-pack-make.patch
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,476 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+From 1c313b21a94a7769a8e69daf0e22ca2c9fc8a74e Mon Sep 17 00:00:00 2001
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+From: barracuda156 <vital.had@gmail.com>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Date: Wed, 17 May 2023 16:17:34 +0800
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Subject: [PATCH 3/4] Revert "Extract FDs from `otherMetadata` when `pack`
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ makes the payload"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+This reverts commit 68198fbee27bb8404e961015e05830f20e0bdbba.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+---
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ thrift/lib/cpp2/CMakeLists.txt | 1 -
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ thrift/lib/cpp2/async/RocketClientChannel.cpp | 13 ++---
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ thrift/lib/cpp2/async/StreamCallbacks.h | 3 -
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .../transport/rocket/FdSocketMetadata.cpp | 51 -----------------
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .../cpp2/transport/rocket/FdSocketMetadata.h | 36 ------------
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .../cpp2/transport/rocket/PayloadUtils.cpp | 6 --
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .../lib/cpp2/transport/rocket/PayloadUtils.h | 39 ++-----------
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ thrift/lib/cpp2/transport/rocket/Types.h | 3 -
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .../rocket/server/RocketThriftRequests.cpp | 2 +-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .../rocket/test/FdSocketMetadataTest.cpp | 55 -------------------
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .../thrift/util/ExceptionUtilTest.java | 12 ++--
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ thrift/lib/thrift/RpcMetadata.thrift | 3 -
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 12 files changed, 17 insertions(+), 207 deletions(-)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ delete mode 100644 thrift/lib/cpp2/transport/rocket/FdSocketMetadata.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ delete mode 100644 thrift/lib/cpp2/transport/rocket/FdSocketMetadata.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ delete mode 100644 thrift/lib/cpp2/transport/rocket/test/FdSocketMetadataTest.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git thrift/lib/cpp2/CMakeLists.txt thrift/lib/cpp2/CMakeLists.txt
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index 9adf60ff54..5b15464285 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- thrift/lib/cpp2/CMakeLists.txt
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ thrift/lib/cpp2/CMakeLists.txt
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -274,7 +274,6 @@ add_library(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ transport/core/ThriftClient.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ transport/core/ThriftClientCallback.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ transport/core/ThriftRequest.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- transport/rocket/FdSocketMetadata.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ transport/rocket/PayloadUtils.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ transport/rocket/Types.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ transport/rocket/client/RequestContext.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git thrift/lib/cpp2/async/RocketClientChannel.cpp thrift/lib/cpp2/async/RocketClientChannel.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index c22256efb8..71dfd6ab14 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- thrift/lib/cpp2/async/RocketClientChannel.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ thrift/lib/cpp2/async/RocketClientChannel.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -49,7 +49,6 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <thrift/lib/cpp2/transport/core/RpcMetadataUtil.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <thrift/lib/cpp2/transport/core/ThriftClientCallback.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <thrift/lib/cpp2/transport/core/TryUtil.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#include <thrift/lib/cpp2/transport/rocket/FdSocketMetadata.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <thrift/lib/cpp2/transport/rocket/PayloadUtils.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <thrift/lib/cpp2/transport/rocket/RocketException.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <thrift/lib/cpp2/transport/rocket/client/RocketClient.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -814,8 +813,7 @@ void RocketClientChannel::sendRequestStream(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ auto buf = std::move(request.buffer);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ setCompression(metadata, buf->computeChainDataLength());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- auto payload = rocket::packWithFds(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- &metadata, std::move(buf), rocket::releaseFdsFromMetadata(metadata));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ auto payload = rocket::pack(metadata, std::move(buf));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ assert(metadata.name_ref());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return rocket::RocketClient::sendRequestStream(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ std::move(payload),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -856,8 +854,7 @@ void RocketClientChannel::sendRequestSink(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ auto buf = std::move(request.buffer);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ setCompression(metadata, buf->computeChainDataLength());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- auto payload = rocket::packWithFds(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- &metadata, std::move(buf), rocket::releaseFdsFromMetadata(metadata));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ auto payload = rocket::pack(metadata, std::move(buf));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ assert(metadata.name_ref());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return rocket::RocketClient::sendRequestSink(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ std::move(payload),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -924,8 +921,7 @@ void RocketClientChannel::sendSingleRequestNoResponse(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ RequestRpcMetadata&& metadata,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ std::unique_ptr<folly::IOBuf> buf,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ RequestClientCallback::Ptr cb) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- auto requestPayload = rocket::packWithFds(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- &metadata, std::move(buf), rocket::releaseFdsFromMetadata(metadata));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ auto requestPayload = rocket::pack(metadata, std::move(buf));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const bool isSync = cb->isSync();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ SingleRequestNoResponseCallback callback(std::move(cb));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -945,8 +941,7 @@ void RocketClientChannel::sendSingleRequestSingleResponse(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ std::unique_ptr<folly::IOBuf> buf,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ RequestClientCallback::Ptr cb) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const auto requestSerializedSize = buf->computeChainDataLength();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- auto requestPayload = rocket::packWithFds(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- &metadata, std::move(buf), rocket::releaseFdsFromMetadata(metadata));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ auto requestPayload = rocket::pack(metadata, std::move(buf));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const auto requestWireSize = requestPayload.dataSize();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const auto requestMetadataAndPayloadSize =
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ requestPayload.metadataAndDataSize();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git thrift/lib/cpp2/async/StreamCallbacks.h thrift/lib/cpp2/async/StreamCallbacks.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index efc2c9349d..41a3d852c1 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- thrift/lib/cpp2/async/StreamCallbacks.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ thrift/lib/cpp2/async/StreamCallbacks.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -26,7 +26,6 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <folly/Utility.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <folly/io/IOBuf.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <folly/io/async/EventBase.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#include <folly/io/async/fdsock/SocketFds.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <thrift/lib/cpp/TApplicationException.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <thrift/lib/cpp/transport/THeader.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -42,7 +41,6 @@ struct FirstResponsePayload {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ std::unique_ptr<folly::IOBuf> payload;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ResponseRpcMetadata metadata;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- folly::SocketFds fds;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ };
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ struct StreamPayload {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -74,7 +72,6 @@ struct StreamPayload {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ StreamPayloadMetadata metadata;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ // OrderedHeader is sent as a PAYLOAD frame with an empty payload
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool isOrderedHeader;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- folly::SocketFds fds;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ };
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ struct HeadersPayload {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git thrift/lib/cpp2/transport/rocket/FdSocketMetadata.cpp thrift/lib/cpp2/transport/rocket/FdSocketMetadata.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+deleted file mode 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index fb1540e4ab..0000000000
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- thrift/lib/cpp2/transport/rocket/FdSocketMetadata.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ /dev/null
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1,51 +0,0 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-/*
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * Copyright (c) Meta Platforms, Inc. and affiliates.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * Licensed under the Apache License, Version 2.0 (the "License");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * you may not use this file except in compliance with the License.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * You may obtain a copy of the License at
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * http://www.apache.org/licenses/LICENSE-2.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * Unless required by applicable law or agreed to in writing, software
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * distributed under the License is distributed on an "AS IS" BASIS,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * See the License for the specific language governing permissions and
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * limitations under the License.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#include <folly/Conv.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#include <folly/File.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#include <folly/String.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#include "FdSocketMetadata.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-namespace apache {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-namespace thrift {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-namespace rocket {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-folly::SocketFds releaseFdsFromMetadata(RequestRpcMetadata& metadata) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- if (!metadata.otherMetadata()) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- return folly::SocketFds{};
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- auto& otherMetadata = *metadata.otherMetadata();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- auto it = otherMetadata.find("__UNSAFE_FDS_FOR_REQUEST__");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- if (it == otherMetadata.end()) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- return folly::SocketFds{};
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- folly::SocketFds::ToSend fds;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- std::vector<folly::StringPiece> fdStrVec;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- folly::split(",", it->second, fdStrVec);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- for (const auto& fdStr : fdStrVec) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- fds.emplace_back(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- std::make_shared<folly::File>(folly::to<int>(fdStr), /*ownsFd*/ false));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- otherMetadata.erase(it);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- return fds.size() ? folly::SocketFds{std::move(fds)} : folly::SocketFds{};
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-} // namespace rocket
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-} // namespace thrift
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-} // namespace apache
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git thrift/lib/cpp2/transport/rocket/FdSocketMetadata.h thrift/lib/cpp2/transport/rocket/FdSocketMetadata.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+deleted file mode 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index 41137eb3f4..0000000000
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- thrift/lib/cpp2/transport/rocket/FdSocketMetadata.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ /dev/null
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1,36 +0,0 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-/*
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * Copyright (c) Meta Platforms, Inc. and affiliates.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * Licensed under the Apache License, Version 2.0 (the "License");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * you may not use this file except in compliance with the License.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * You may obtain a copy of the License at
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * http://www.apache.org/licenses/LICENSE-2.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * Unless required by applicable law or agreed to in writing, software
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * distributed under the License is distributed on an "AS IS" BASIS,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * See the License for the specific language governing permissions and
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * limitations under the License.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#pragma once
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#include <folly/io/async/fdsock/SocketFds.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#include <thrift/lib/cpp2/transport/rocket/Types.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#include <thrift/lib/thrift/gen-cpp2/RpcMetadata_types.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-namespace apache {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-namespace thrift {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-namespace rocket {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-// Remove the temporary proof-of-concept "plumbing key" from the headers.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-// Instead, update the metadata with the number of FDs being sent.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-//
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-// For the real deal, we will want to plumb through proper C++ objects
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-// representing FD ownership.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-folly::SocketFds releaseFdsFromMetadata(RequestRpcMetadata&);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-} // namespace rocket
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-} // namespace thrift
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-} // namespace apache
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git thrift/lib/cpp2/transport/rocket/PayloadUtils.cpp thrift/lib/cpp2/transport/rocket/PayloadUtils.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index 82a87adb1f..e172a0a1f4 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- thrift/lib/cpp2/transport/rocket/PayloadUtils.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ thrift/lib/cpp2/transport/rocket/PayloadUtils.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -24,12 +24,6 @@ namespace detail {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ template <class Metadata>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Payload makePayload(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const Metadata& metadata, std::unique_ptr<folly::IOBuf> data) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- DCHECK(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- !metadata.otherMetadata() ||
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- !metadata.otherMetadata()->contains("__UNSAFE_FDS_FOR_REQUEST__"))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- << "Not implemented: attaching FDs via "
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- << "otherMetadata[__UNSAFE_FDS_FOR_REQUEST__] on this code path";
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ CompactProtocolWriter writer;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ // Default is to leave some headroom for rsocket headers
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ size_t serSize = metadata.serializedSizeZC(&writer);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git thrift/lib/cpp2/transport/rocket/PayloadUtils.h thrift/lib/cpp2/transport/rocket/PayloadUtils.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index 6751a2b351..9aa0941e68 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- thrift/lib/cpp2/transport/rocket/PayloadUtils.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ thrift/lib/cpp2/transport/rocket/PayloadUtils.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -157,48 +157,21 @@ inline std::unique_ptr<folly::IOBuf> packCompact(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return std::move(data);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-// NB: Populates `metadata.numFds` if `fds` is nonempty.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ template <typename Payload, typename Metadata>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-rocket::Payload packWithFds(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- Metadata* metadata, Payload&& payload, folly::SocketFds fds) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++rocket::Payload pack(const Metadata& metadata, Payload&& payload) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ auto serializedPayload = packCompact(std::forward<Payload>(payload));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- if (auto compress = metadata->compression_ref()) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (auto compress = metadata.compression_ref()) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ apache::thrift::rocket::detail::compressPayload(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ serializedPayload, *compress);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- auto numFds = fds.size();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- if (numFds) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- // When received, the request will know to retrieve this many FDs.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- //
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- // NB: The receiver could more confidently assert that the right FDs are
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- // associated with the right request if we could:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- // - Additionally store the "socket sequence number" of these FDs into
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- // the metadata here.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- // - Have `AsyncFdSocket::writeIOBufsWithFds` check, via a token
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- // object, that the sequence number chosen at parse-time matches the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- // actual write order).
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- // Unfortunately, implementing this check would require adding
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- // considerable plumbing to Rocket, so we skip it in favor of asserting
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- // we got the right # of FDs, and documenting the correct FD+data
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- // ordering invariant in the client & server code that interacts with
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- // the socket.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- metadata->numFds() = numFds;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- auto ret = apache::thrift::rocket::detail::makePayload(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- *metadata, std::move(serializedPayload));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- if (numFds) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- ret.fds = std::move(fds.dcheckToSend());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- return ret;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return apache::thrift::rocket::detail::makePayload(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ metadata, std::move(serializedPayload));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ template <class T>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ rocket::Payload pack(T&& payload) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- auto metadata = std::forward<T>(payload).metadata;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- return packWithFds(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- &metadata,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- std::forward<T>(payload).payload,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- std::forward<T>(payload).fds);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return pack(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ std::forward<T>(payload).metadata, std::forward<T>(payload).payload);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } // namespace rocket
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } // namespace thrift
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git thrift/lib/cpp2/transport/rocket/Types.h thrift/lib/cpp2/transport/rocket/Types.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index 891dbe661a..650d3537a4 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- thrift/lib/cpp2/transport/rocket/Types.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ thrift/lib/cpp2/transport/rocket/Types.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -23,7 +23,6 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <folly/Range.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <folly/io/IOBuf.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#include <folly/io/async/fdsock/SocketFds.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ namespace apache {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ namespace thrift {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -142,8 +141,6 @@ class Payload {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool hasData() const { return buffer_ != nullptr; }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- folly::SocketFds fds;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ private:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ std::unique_ptr<folly::IOBuf> buffer_;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ size_t metadataSize_{0};
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git thrift/lib/cpp2/transport/rocket/server/RocketThriftRequests.cpp thrift/lib/cpp2/transport/rocket/server/RocketThriftRequests.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index 48502cf221..e99598ef77 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- thrift/lib/cpp2/transport/rocket/server/RocketThriftRequests.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ thrift/lib/cpp2/transport/rocket/server/RocketThriftRequests.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -470,7 +470,7 @@ void ThriftServerRequestResponse::sendThriftResponse(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ context_.sendPayload(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- packWithFds(&metadata, std::move(data), folly::SocketFds{}),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ pack(metadata, std::move(data)),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Flags().next(true).complete(true),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ std::move(cb));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git thrift/lib/cpp2/transport/rocket/test/FdSocketMetadataTest.cpp thrift/lib/cpp2/transport/rocket/test/FdSocketMetadataTest.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+deleted file mode 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index 71fe08942d..0000000000
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- thrift/lib/cpp2/transport/rocket/test/FdSocketMetadataTest.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ /dev/null
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1,55 +0,0 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-/*
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * Copyright (c) Meta Platforms, Inc. and affiliates.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * Licensed under the Apache License, Version 2.0 (the "License");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * you may not use this file except in compliance with the License.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * You may obtain a copy of the License at
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * http://www.apache.org/licenses/LICENSE-2.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * Unless required by applicable law or agreed to in writing, software
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * distributed under the License is distributed on an "AS IS" BASIS,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * See the License for the specific language governing permissions and
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- * limitations under the License.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#include <folly/portability/GTest.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#include <thrift/lib/cpp2/transport/rocket/FdSocketMetadata.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-using namespace apache::thrift;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-TEST(FdSocketMetadata, ReleaseFdsFromMetadataEmpty) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- RequestRpcMetadata emptyMeta;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- EXPECT_TRUE(rocket::releaseFdsFromMetadata(emptyMeta).empty());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- EXPECT_EQ(RequestRpcMetadata{}, emptyMeta); // no changes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- RequestRpcMetadata noMagicKey;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- noMagicKey.otherMetadata() = {};
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- EXPECT_TRUE(rocket::releaseFdsFromMetadata(noMagicKey).empty());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- RequestRpcMetadata alsoNoMagicKey;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- alsoNoMagicKey.otherMetadata() = {};
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- EXPECT_EQ(alsoNoMagicKey, noMagicKey);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-TEST(FdSocketMetadata, ReleaseFdsFromMetadata) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- RequestRpcMetadata meta;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- meta.otherMetadata() = {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- {"__UNSAFE_FDS_FOR_REQUEST__", "2,0,1"},
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- {"OtherKeysAreNotDeleted", "whew"},
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- };
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- auto fds = rocket::releaseFdsFromMetadata(meta);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- RequestRpcMetadata noMagicKey;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- noMagicKey.otherMetadata() = {{"OtherKeysAreNotDeleted", "whew"}};
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- EXPECT_EQ(noMagicKey, meta);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- EXPECT_EQ(3, fds.size());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- auto sendFds = fds.releaseToSend();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- EXPECT_TRUE(fds.empty());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- EXPECT_EQ(3, sendFds.size());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- EXPECT_EQ(2, sendFds[0]->fd());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- EXPECT_EQ(0, sendFds[1]->fd());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- EXPECT_EQ(1, sendFds[2]->fd());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git thrift/lib/java/runtime/src/test/java/com/facebook/thrift/util/ExceptionUtilTest.java thrift/lib/java/runtime/src/test/java/com/facebook/thrift/util/ExceptionUtilTest.java
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index aed59b46e0..fb2240ee43 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- thrift/lib/java/runtime/src/test/java/com/facebook/thrift/util/ExceptionUtilTest.java
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ thrift/lib/java/runtime/src/test/java/com/facebook/thrift/util/ExceptionUtilTest.java
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -75,7 +75,7 @@ public class ExceptionUtilTest {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ResponseRpcMetadata metadata =
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ new ResponseRpcMetadata(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- Collections.singletonMap("ex", "x"), 0L, 0, null, null, null, 0, null, null);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ Collections.singletonMap("ex", "x"), 0L, 0, null, null, null, 0, null);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ClientResponsePayload responsePayload =
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ClientResponsePayload.createException(myExp, metadata, null, false);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -90,7 +90,7 @@ public class ExceptionUtilTest {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ResponseRpcMetadata metadata =
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ new ResponseRpcMetadata(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- Collections.singletonMap("ex", "3"), 0L, 0, null, null, null, 0, null, null);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ Collections.singletonMap("ex", "3"), 0L, 0, null, null, null, 0, null);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ClientResponsePayload responsePayload =
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ClientResponsePayload.createException(myExp, metadata, null, false);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -106,7 +106,7 @@ public class ExceptionUtilTest {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ResponseRpcMetadata metadata =
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ new ResponseRpcMetadata(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- Collections.singletonMap("ex", "3"), 0L, 0, null, null, null, 0, null, null);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ Collections.singletonMap("ex", "3"), 0L, 0, null, null, null, 0, null);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ClientResponsePayload responsePayload =
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ClientResponsePayload.createException(myExp, metadata, null, false);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -121,7 +121,7 @@ public class ExceptionUtilTest {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ResponseRpcMetadata metadata =
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ new ResponseRpcMetadata(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- Collections.singletonMap("ex", "4"), 0L, 0, null, null, null, 0, null, null);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ Collections.singletonMap("ex", "4"), 0L, 0, null, null, null, 0, null);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ClientResponsePayload responsePayload =
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ClientResponsePayload.createException(myExp, metadata, null, false);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -135,7 +135,7 @@ public class ExceptionUtilTest {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ MyException myExp = new MyException("my exception");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ResponseRpcMetadata metadata =
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- new ResponseRpcMetadata(Collections.emptyMap(), 0L, 0, null, null, null, 0, null, null);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ new ResponseRpcMetadata(Collections.emptyMap(), 0L, 0, null, null, null, 0, null);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ClientResponsePayload responsePayload =
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ClientResponsePayload.createException(myExp, metadata, null, false);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -149,7 +149,7 @@ public class ExceptionUtilTest {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ResponseRpcMetadata metadata =
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ new ResponseRpcMetadata(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- Collections.singletonMap("ex", "5"), 0L, 0, null, null, null, 0, null, null);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ Collections.singletonMap("ex", "5"), 0L, 0, null, null, null, 0, null);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ClientResponsePayload responsePayload =
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ClientResponsePayload.createException(myExp, metadata, null, false);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git thrift/lib/thrift/RpcMetadata.thrift thrift/lib/thrift/RpcMetadata.thrift
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index 35f7a7f21f..d560de2eae 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- thrift/lib/thrift/RpcMetadata.thrift
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ thrift/lib/thrift/RpcMetadata.thrift
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -187,7 +187,6 @@ struct RequestRpcMetadata {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ // Thrift is typically used within a larger framework.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ // This field is for storing framework-specific metadata.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 20: optional IOBufPtr frameworkMetadata;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- 21: optional i32 numFds; // Linux currently limits this to SCM_MAX_FD.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ struct ErrorClassification {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -285,7 +284,6 @@ struct ResponseRpcMetadata {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 9: optional i32 streamId;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ // Set on a sampled basis for tracking queueing times.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 10: optional QueueMetadata queueMetadata;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- 11: optional i32 numFds; // Linux currently limits this to SCM_MAX_FD.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ enum ResponseRpcErrorCategory {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -386,7 +384,6 @@ struct StreamPayloadMetadata {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ // Metadata describing the type of stream payload. MUST be set for protocol
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ // version 8+.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 3: optional PayloadMetadata payloadMetadata;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- 4: optional i32 numFds; // Linux currently limits this to SCM_MAX_FD.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ // Setup metadata sent from the client to the server at the time
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+2.40.1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/devel/fbthrift/files/0004-Revert-Use-AsyncFdSocket-when-accepting-Unix-socket-.patch b/devel/fbthrift/files/0004-Revert-Use-AsyncFdSocket-when-accepting-Unix-socket-.patch
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..10595cc6d0e
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/devel/fbthrift/files/0004-Revert-Use-AsyncFdSocket-when-accepting-Unix-socket-.patch
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,77 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+From 872d5c59ed7a55f4f19af7b1296f014206946616 Mon Sep 17 00:00:00 2001
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+From: barracuda156 <vital.had@gmail.com>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Date: Wed, 17 May 2023 16:54:15 +0800
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Subject: [PATCH 4/4] Revert "Use `AsyncFdSocket` when accepting Unix socket
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ connections"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+This reverts commit 7631d8f859447ffc24bb9022a72f1419a4db66d3.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+---
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ thrift/lib/cpp2/server/Cpp2Worker.cpp | 18 ------------------
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ thrift/lib/cpp2/server/Cpp2Worker.h | 5 -----
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 2 files changed, 23 deletions(-)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git thrift/lib/cpp2/server/Cpp2Worker.cpp thrift/lib/cpp2/server/Cpp2Worker.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index 24662548a7..9225600db5 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- thrift/lib/cpp2/server/Cpp2Worker.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ thrift/lib/cpp2/server/Cpp2Worker.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -26,11 +26,9 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <folly/io/async/AsyncSSLSocket.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <folly/io/async/AsyncSocket.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <folly/io/async/EventBaseLocal.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#include <folly/io/async/fdsock/AsyncFdSocket.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <folly/portability/Sockets.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <thrift/lib/cpp/async/TAsyncSSLSocket.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <thrift/lib/cpp/concurrency/Util.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#include <thrift/lib/cpp2/Flags.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <thrift/lib/cpp2/async/ResponseChannel.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <thrift/lib/cpp2/security/extensions/ThriftParametersContext.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <thrift/lib/cpp2/server/Cpp2Connection.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -42,10 +40,6 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <wangle/acceptor/SSLAcceptorHandshakeHelper.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <wangle/acceptor/UnencryptedAcceptorHandshakeHelper.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-// DANGER: If you disable this overly broadly, this can completely break
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-// workloads that rely on passing FDs over Unix sockets + Thrift.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-THRIFT_FLAG_DEFINE_bool(enable_server_async_fd_socket, /* default = */ true);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ namespace apache {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ namespace thrift {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -198,18 +192,6 @@ void Cpp2Worker::plaintextConnectionReady(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ server_->getObserverShared());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-folly::AsyncSocket::UniquePtr Cpp2Worker::makeNewAsyncSocket(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- folly::EventBase* base, int fd, const folly::SocketAddress* peerAddress) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- if (THRIFT_FLAG(enable_server_async_fd_socket) &&
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- peerAddress->getFamily() == AF_UNIX) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- VLOG(4) << "Enabling AsyncFdSocket"; // peerAddress is always anonymous
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- // Enable passing FDs over Unix sockets, see `man cmsg`.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- return folly::AsyncSocket::UniquePtr(new folly::AsyncFdSocket(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- base, folly::NetworkSocket::fromFd(fd), peerAddress));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- return Acceptor::makeNewAsyncSocket(base, fd, peerAddress);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ void Cpp2Worker::useExistingChannel(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const std::shared_ptr<HeaderServerChannel>& serverChannel) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ folly::SocketAddress address;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git thrift/lib/cpp2/server/Cpp2Worker.h thrift/lib/cpp2/server/Cpp2Worker.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index 951a62019e..0275f7caed 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- thrift/lib/cpp2/server/Cpp2Worker.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ thrift/lib/cpp2/server/Cpp2Worker.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -390,11 +390,6 @@ class Cpp2Worker : public IOWorkerContext,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mutable folly::F14NodeMap<AsyncProcessorFactory*, PerServiceMetadata>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ perServiceMetadata_;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- folly::AsyncSocket::UniquePtr makeNewAsyncSocket(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- folly::EventBase* base,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- int fd,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- const folly::SocketAddress* peerAddress) override;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ folly::AsyncSSLSocket::UniquePtr makeNewAsyncSSLSocket(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const std::shared_ptr<folly::SSLContext>& ctx,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ folly::EventBase* base,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+2.40.1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span></pre><pre style='margin:0'>
</pre>