Commit cd60da45 authored by Songqiao Su's avatar Songqiao Su Committed by Facebook GitHub Bot

release write buffer before calling write callback

Summary: As the main purpose of write callback is to signal the buffer is on longer needed and may be released (https://fburl.com/diffusion/ahbbb6oy). Release the buffer then calling the write callback seems more reasonable

Differential Revision: D23411380

fbshipit-source-id: c9b421716368253eafb4ecb8b72f48c8b47c2f9f
parent 3d5e5974
...@@ -1159,7 +1159,10 @@ void AsyncSocket::writeImpl( ...@@ -1159,7 +1159,10 @@ void AsyncSocket::writeImpl(
// done, add the whole buffer // done, add the whole buffer
if (countWritten && isZeroCopyRequest(flags)) { if (countWritten && isZeroCopyRequest(flags)) {
addZeroCopyBuf(std::move(ioBuf)); addZeroCopyBuf(std::move(ioBuf));
} else {
ioBuf.reset();
} }
// We successfully wrote everything. // We successfully wrote everything.
// Invoke the callback and return. // Invoke the callback and return.
if (callback) { if (callback) {
......
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