Commit 8e2ec4c3 authored by Dave Watson's avatar Dave Watson Committed by Viswanath Sivakumar

Pipeline OutputBufferingHandler

Summary: Part 2 of pipeline.  Use OutputBufferingHandler, which is exactly the same output buffering thrift does currently.

Test Plan:
A couple canaries, unittests.
Specific issues of previous pipeline diffs I think are fixed already and should be fine with this one:
* Previously there were missing DestructorGuards.  I don't think anything in OutputBUfferHandler needs a DG
* previously broke http GET handling.  There is a unittest for it now.

Canary

Reviewed By: alandau@fb.com

Subscribers: doug, fugalh, alandau, bmatheny, mshneer, folly-diffs@, jsedgwick, yfeldblum, chalfant, vloh, andreib

FB internal diff: D1970949

Signature: t1:1970949:1428360621:a0db142032894525f69c2b144cf946d63f790fe1
parent 51026ab6
......@@ -63,6 +63,22 @@ class OutputBufferingHandler : public BytesToBytesHandler,
});
}
Future<void> close(Context* ctx) override {
if (isLoopCallbackScheduled()) {
cancelLoopCallback();
}
// If there are sends queued, cancel them
for (auto& promise : promises_) {
promise.setException(
folly::make_exception_wrapper<std::runtime_error>(
"close() called while sends still pending"));
}
sends_.reset();
promises_.clear();
return ctx->fireClose();
}
std::vector<Promise<void>> promises_;
std::unique_ptr<IOBuf> sends_{nullptr};
bool queueSends_{true};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment