Skip to content

Commit

Permalink
Fix "IOBufQueue: chain length not cached" exception
Browse files Browse the repository at this point in the history
Summary:
We create `inputQueueCopy` without the
`folly::IOBufQueue::cacheChainLength()` option, then assign it to `inputQueue_`
and use `.chainLength()`.

This diff fixes `inputQueueCopy` to be created with a cached length.

Reviewed By: ckwalsh

Differential Revision: D2908010

fb-gh-sync-id: 25f1a9ededa5d8341535be23a89d0fd971db85d5
  • Loading branch information
alandau authored and facebook-github-bot-1 committed Feb 6, 2016
1 parent f7a070d commit 34a85e1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion thrift/lib/cpp2/async/ProtectionHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ void ProtectionHandler::read(Context* ctx, folly::IOBufQueue& q) {
// If decryption fails, we try to read again without decrypting.
// The copy is necessary since a decryption attempt modifies the
// queue.
folly::IOBufQueue inputQueueCopy;
folly::IOBufQueue inputQueueCopy(
folly::IOBufQueue::cacheChainLength());
auto copyBuf = inputQueue_.front()->clone();
copyBuf->unshare();
inputQueueCopy.append(std::move(copyBuf));
Expand Down

0 comments on commit 34a85e1

Please sign in to comment.