mirror of
https://github.com/clearlinux/folly.git
synced 2026-09-01 11:15:52 +00:00
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
This commit is contained in:
committed by
Viswanath Sivakumar
parent
51026ab609
commit
8e2ec4c397
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user