Unverified Commit 8b9bd720 authored by Kenton Varda's avatar Kenton Varda Committed by GitHub

Merge pull request #771 from capnproto/fix-async-tee-cancellation

Fix cancellation in AsyncTee::PumpSink.
parents f2f42219 c55728b8
......@@ -1397,8 +1397,9 @@ private:
if (amount > 0) {
Promise<void> promise = nullptr;
// TODO(soon): Replace try/catch with kj::evalNow() to work with -fno-exceptions.
try {
promise = canceler.wrap(output.write(writeBuffer).attach(mv(writeBuffer)));
promise = output.write(writeBuffer).attach(mv(writeBuffer));
} catch (const Exception& exception) {
reject(cp(exception));
return READY_NOW;
......@@ -1414,7 +1415,7 @@ private:
reject(mv(exception));
});
return mv(promise);
return canceler.wrap(mv(promise)).catch_([](kj::Exception&&) {});
} else KJ_IF_MAYBE(reason, stoppage) {
if (reason->is<Eof>()) {
// Unlike in the read case, it makes more sense to immediately propagate exceptions to the
......
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