From 9053597166820b60976bf936fd31c84c84d82d30 Mon Sep 17 00:00:00 2001 From: Misha Shneerson Date: Tue, 14 Sep 2021 22:19:09 -0700 Subject: [PATCH] avoid bumping shared_ptr refcount in `collectRequestDebugLog` Reviewed By: praihan Differential Revision: D30946132 fbshipit-source-id: e0f7f131085442e5ef742c58ae9c2553b383ae10 --- thrift/lib/cpp2/server/RequestDebugLog.cpp | 4 ++-- thrift/lib/cpp2/server/RequestDebugLog.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/thrift/lib/cpp2/server/RequestDebugLog.cpp b/thrift/lib/cpp2/server/RequestDebugLog.cpp index 6b3f6f19004..fecb60e021c 100644 --- a/thrift/lib/cpp2/server/RequestDebugLog.cpp +++ b/thrift/lib/cpp2/server/RequestDebugLog.cpp @@ -102,7 +102,7 @@ void appendRequestDebugLog(const std::string& msg) { } std::vector collectRequestDebugLog( - std::shared_ptr rctx) { + const std::shared_ptr& rctx) { DCHECK(rctx.get() != nullptr); auto log = dynamic_cast(rctx->getContextData(getToken())); if (log == nullptr) { @@ -117,7 +117,7 @@ std::vector collectRequestDebugLog( if (rctx == nullptr) { return {}; } - return collectRequestDebugLog(std::move(rctx)); + return collectRequestDebugLog(rctx); } } // namespace thrift diff --git a/thrift/lib/cpp2/server/RequestDebugLog.h b/thrift/lib/cpp2/server/RequestDebugLog.h index da5662e0b21..a818a6a8fba 100644 --- a/thrift/lib/cpp2/server/RequestDebugLog.h +++ b/thrift/lib/cpp2/server/RequestDebugLog.h @@ -30,7 +30,7 @@ namespace thrift { void appendRequestDebugLog(std::string&&); void appendRequestDebugLog(const std::string&); std::vector collectRequestDebugLog( - std::shared_ptr); + const std::shared_ptr&); std::vector collectRequestDebugLog( const RequestsRegistry::DebugStub&);