Remove BodyReader::is_deferred (API Change):

The is_deferred nested type is removed from the BodyReader
requirements.

Performance for sending messages with `file_body` was cut
almost in half with is_deferred as `std::true_type` since
it caused double the number of socket writes. If the
deferred behavior is absolutely necessary, callers can get
the same effect by manually sending the headers first.

Actions Required:

* Callers who need the behavior of is_deferred as `std::true_type`
  should manually construct a serializer and serialize the header
  first, followed by the body.
This commit is contained in:
Vinnie Falco
2017-07-20 08:15:29 -07:00
parent bf59634bc2
commit edeb44617b
12 changed files with 24 additions and 86 deletions
-10
View File
@@ -98,14 +98,6 @@ class file_body::reader
char buf_[4096]; // Small buffer for reading
public:
// This nested type informs the serializer that it should
// wait until after sending the header to initialize the
// reader. We set this to true, otherwise opening the file
// during `init` could introduce latency which delays
// the remote endpoint from receiving the header quickly.
//
using is_deferred = std::true_type;
// The type of buffer sequence returned by `get`.
//
using const_buffers_type =
@@ -113,8 +105,6 @@ public:
// Constructor.
//
// This is called after the header is serialized, because
// we declared `is_deferred` to be `std::true_type`.
// `m` holds the message we are sending, which will
// always have the `file_body` as the body type.
//