-void AsyncSocket::adjustZeroCopyFlags(
- folly::IOBuf* buf,
- folly::WriteFlags& flags) {
- if (zeroCopyEnabled_ && zeroCopyWriteChainThreshold_ && buf) {
- if (buf->computeChainDataLength() >= zeroCopyWriteChainThreshold_) {
- flags |= folly::WriteFlags::WRITE_MSG_ZEROCOPY;
- } else {
- flags = unSet(flags, folly::WriteFlags::WRITE_MSG_ZEROCOPY);
- }
- }
-}
-
-void AsyncSocket::adjustZeroCopyFlags(
- const iovec* vec,
- uint32_t count,
- folly::WriteFlags& flags) {
- if (zeroCopyEnabled_ && zeroCopyWriteChainThreshold_) {
- count = std::min<uint32_t>(count, kIovMax);
- size_t sum = 0;
- for (uint32_t i = 0; i < count; ++i) {
- const iovec* v = vec + i;
- sum += v->iov_len;
- }
-
- if (sum >= zeroCopyWriteChainThreshold_) {
- flags |= folly::WriteFlags::WRITE_MSG_ZEROCOPY;
- } else {
- flags = unSet(flags, folly::WriteFlags::WRITE_MSG_ZEROCOPY);
- }
+void AsyncSocket::adjustZeroCopyFlags(folly::WriteFlags& flags) {
+ if (!zeroCopyEnabled_) {
+ flags = unSet(flags, folly::WriteFlags::WRITE_MSG_ZEROCOPY);