Opened 4 years ago
Last modified 4 years ago
#13584 new Bugs
boost beast flat buffer move ctor, move assign and swap all "cancel" a prepare()
Reported by: | Owned by: | chris_kohlhoff | |
---|---|---|---|
Milestone: | To Be Determined | Component: | asio |
Version: | Boost 1.67.0 | Severity: | Problem |
Keywords: | beast | Cc: |
Description
The boost beast flat_buffer "cancels" any outstanding prepare() when being moved from or swapped.
This seems like a very sane thing to do.
However, boost::asio::async_read_until depends on calling prepare() on it's DynamicBuffer and then calling the corresponding commit() on a moved-to version.
Flat buffer will (correctly) silently commit the minimum of the requested size and the size from the previous prepare(). When used with async_read_until, the commit is always zero, since the prepare was "cancelled" by the move.
The flat_buffer code always sets last_ to out_ during a move or swap, which is what achieves what I am calling the "cancel" of the prepare().
I tested setting last_ to other.last_ in the move ctor, move assignment, and swap, and verified that asio::async_read_until now works with beast::flat_buffer On this report I set component=asio, because I couldn't find beast on the drop box.
I'm working with 1.67 and g++ 7.30 on ubuntu 18.04
Please consider this withdrawn.
The beast flat_buffer matches the asio::is_dynamic_buffer check due to the alignment of method signatures, but isn't intended to actually be an asio dynamic buffer.
"fixing" the move allowd the async_read_until to complete, but ( of course ) my buffer had been moved from, and my actual data was long gone.