Skip to content

Commit

Permalink
cleanup TServerEventHandler connectionNewRequest callback
Browse files Browse the repository at this point in the history
Reviewed By: jmswen

Differential Revision: D22736635

fbshipit-source-id: 8c64c23a5e7e0838571aaddd0b9cb88cb5869f8e
  • Loading branch information
clairezhang-fb authored and facebook-github-bot committed Jul 27, 2020
1 parent 482db15 commit 9f20e2d
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 24 deletions.
16 changes: 0 additions & 16 deletions thrift/lib/cpp/server/TServerEventHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 1 addition & 4 deletions thrift/lib/cpp2/server/Cpp2Connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,7 @@ void Cpp2Connection::requestReceived(
auto reqCtx = baseReqCtx
? folly::RequestContext::copyAsRoot(*baseReqCtx, rootid)
: std::make_shared<folly::RequestContext>(rootid);
auto handler = worker_->getServer()->getEventHandlerUnsafe();
if (handler) {
handler->connectionNewRequest(&context_, reqCtx.get());
}

folly::RequestContextScopeGuard rctx(reqCtx);

auto server = worker_->getServer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,6 @@ void ThriftRocketServerHandler::handleRequestCommon(
? folly::RequestContext::copyAsRoot(*baseReqCtx, rootid)
: std::make_shared<folly::RequestContext>(rootid);

if (auto* handler = worker_->getServer()->getEventHandlerUnsafe()) {
handler->connectionNewRequest(&connContext_, reqCtx.get());
}

folly::RequestContextScopeGuard rctx(reqCtx);

auto requestPayloadTry = unpack<RequestPayload>(std::move(payload));
Expand Down

0 comments on commit 9f20e2d

Please sign in to comment.