if (0 == --iter1->second.count_) {
idZeroCopyBufInfoMap_.erase(iter1);
}
+
+ idZeroCopyBufPtrMap_.erase(iter);
}
void AsyncSocket::setZeroCopyBuf(std::unique_ptr<folly::IOBuf>&& buf) {
return failWrite(__func__, callback, 0, ex);
} else if (countWritten == count) {
// done, add the whole buffer
- if (isZeroCopyRequest(flags)) {
+ if (countWritten && isZeroCopyRequest(flags)) {
addZeroCopyBuf(std::move(ioBuf));
}
// We successfully wrote everything.
return;
} else { // continue writing the next writeReq
// add just the ptr
- if (isZeroCopyRequest(flags)) {
+ if (bytesWritten && isZeroCopyRequest(flags)) {
addZeroCopyBuf(ioBuf.get());
}
if (bufferCallback_) {
#endif // FOLLY_HAVE_MSG_ERRQUEUE
}
+bool AsyncSocket::processZeroCopyWriteInProgress() noexcept {
+ eventBase_->dcheckIsInEventBaseThread();
+ if (idZeroCopyBufPtrMap_.empty()) {
+ return true;
+ }
+
+ handleErrMessages();
+
+ return idZeroCopyBufPtrMap_.empty();
+}
+
void AsyncSocket::handleRead() noexcept {
VLOG(5) << "AsyncSocket::handleRead() this=" << this << ", fd=" << fd_
<< ", state=" << state_;