From 9f20e2ddd0e47ba4d717b44f8005c65c901d30d3 Mon Sep 17 00:00:00 2001 From: "Claire (Yue) Zhang" Date: Sun, 26 Jul 2020 22:57:58 -0700 Subject: [PATCH] cleanup TServerEventHandler connectionNewRequest callback Reviewed By: jmswen Differential Revision: D22736635 fbshipit-source-id: 8c64c23a5e7e0838571aaddd0b9cb88cb5869f8e --- thrift/lib/cpp/server/TServerEventHandler.h | 16 ---------------- thrift/lib/cpp2/server/Cpp2Connection.cpp | 5 +---- .../rocket/server/ThriftRocketServerHandler.cpp | 4 ---- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/thrift/lib/cpp/server/TServerEventHandler.h b/thrift/lib/cpp/server/TServerEventHandler.h index 333fdbb29db..5705e37883e 100644 --- a/thrift/lib/cpp/server/TServerEventHandler.h +++ b/thrift/lib/cpp/server/TServerEventHandler.h @@ -72,22 +72,6 @@ class TServerEventHandler { (void)ctx; } - /** - * Called when a connection started processing a new request. - * - * @param connCtx A pointer to the connection context. The context will remain - * valid until the corresponding connectionDestroyed() call. - * @param reqCtx A pointer to folly::RequestContext specific to this request. - * The context will remain valid until everything started by - * this request stopped running. - */ - virtual void connectionNewRequest( - TConnectionContext* connCtx, - folly::RequestContext* reqCtx) { - (void)connCtx; - (void)reqCtx; - } - /** * Called when a client has finished request-handling to delete server * context. diff --git a/thrift/lib/cpp2/server/Cpp2Connection.cpp b/thrift/lib/cpp2/server/Cpp2Connection.cpp index a3a69e6b0c9..eefd12c8332 100644 --- a/thrift/lib/cpp2/server/Cpp2Connection.cpp +++ b/thrift/lib/cpp2/server/Cpp2Connection.cpp @@ -234,10 +234,7 @@ void Cpp2Connection::requestReceived( auto reqCtx = baseReqCtx ? folly::RequestContext::copyAsRoot(*baseReqCtx, rootid) : std::make_shared(rootid); - auto handler = worker_->getServer()->getEventHandlerUnsafe(); - if (handler) { - handler->connectionNewRequest(&context_, reqCtx.get()); - } + folly::RequestContextScopeGuard rctx(reqCtx); auto server = worker_->getServer(); diff --git a/thrift/lib/cpp2/transport/rocket/server/ThriftRocketServerHandler.cpp b/thrift/lib/cpp2/transport/rocket/server/ThriftRocketServerHandler.cpp index 5652faf0d91..96fcf2e38a5 100644 --- a/thrift/lib/cpp2/transport/rocket/server/ThriftRocketServerHandler.cpp +++ b/thrift/lib/cpp2/transport/rocket/server/ThriftRocketServerHandler.cpp @@ -300,10 +300,6 @@ void ThriftRocketServerHandler::handleRequestCommon( ? folly::RequestContext::copyAsRoot(*baseReqCtx, rootid) : std::make_shared(rootid); - if (auto* handler = worker_->getServer()->getEventHandlerUnsafe()) { - handler->connectionNewRequest(&connContext_, reqCtx.get()); - } - folly::RequestContextScopeGuard rctx(reqCtx); auto requestPayloadTry = unpack(std::move(payload));