From: Dan Melnic Date: Tue, 17 Oct 2017 23:27:56 +0000 (-0700) Subject: Do not set WriteFlags::WRITE_MSG_ZEROCOPY if the buffer ! isManaged() X-Git-Tag: v2017.10.23.00~32 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=68d54bdd5d12c622104d2d621e8190827d06145d;p=folly.git Do not set WriteFlags::WRITE_MSG_ZEROCOPY if the buffer ! isManaged() Summary: Do not set WriteFlags::WRITE_MSG_ZEROCOPY if the buffer isShared() Reviewed By: yfeldblum Differential Revision: D6068711 fbshipit-source-id: fff14dcd4fcb20c9dbb60794420845042518922c --- diff --git a/folly/io/async/AsyncSocket.cpp b/folly/io/async/AsyncSocket.cpp index 7347dc68..991b225c 100644 --- a/folly/io/async/AsyncSocket.cpp +++ b/folly/io/async/AsyncSocket.cpp @@ -861,7 +861,8 @@ bool AsyncSocket::isZeroCopyRequest(WriteFlags flags) { void AsyncSocket::adjustZeroCopyFlags( folly::IOBuf* buf, folly::WriteFlags& flags) { - if (zeroCopyEnabled_ && zeroCopyWriteChainThreshold_ && buf) { + if (zeroCopyEnabled_ && zeroCopyWriteChainThreshold_ && buf && + buf->isManaged()) { if (buf->computeChainDataLength() >= zeroCopyWriteChainThreshold_) { flags |= folly::WriteFlags::WRITE_MSG_ZEROCOPY; } else {