Tune up static_buffer (API Change):

The static buffer is updated:

* reset() is no longer a member. Use b.consume(b.size()) instead.

* Simplified implementaton, uses asio instead of custom types

* Better stream performance: consuming the input makes room
  available in the output. This class is now suitable for
  HTTP reads.

These changes permit the static_buffer wrapper to adapt a user
memory buffer if desired, including a stack based array.
The static_buffer_n class may also be used for this purpose,
it comes with its own storage.
This commit is contained in:
Vinnie Falco
2017-06-07 19:21:33 -07:00
parent 20c59b7e22
commit 53cbeea596
9 changed files with 187 additions and 441 deletions
+2 -2
View File
@@ -279,7 +279,7 @@ operator()(error_code ec,
case do_nomask_frag + 2:
d.cb.consume(
bytes_transferred - d.fh_buf.size());
d.fh_buf.reset();
d.fh_buf.consume(d.fh_buf.size());
d.fh.op = opcode::cont;
if(d.ws.wr_block_ == &d)
d.ws.wr_block_ = nullptr;
@@ -384,7 +384,7 @@ operator()(error_code ec,
case do_mask_frag + 2:
d.cb.consume(
bytes_transferred - d.fh_buf.size());
d.fh_buf.reset();
d.fh_buf.consume(d.fh_buf.size());
d.fh.op = opcode::cont;
BOOST_ASSERT(d.ws.wr_block_ == &d);
d.ws.wr_block_ = nullptr;