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
+4 -16
View File
@@ -42,8 +42,6 @@ public:
value_type const& body_;
public:
using is_deferred = std::false_type;
using const_buffers_type =
boost::asio::const_buffers_1;
@@ -67,7 +65,6 @@ public:
};
template<
bool isDeferred,
bool isSplit,
bool isFinalEmpty
>
@@ -85,9 +82,6 @@ public:
value_type const& body_;
public:
using is_deferred =
std::integral_constant<bool, isDeferred>;
using const_buffers_type =
boost::asio::const_buffers_1;
@@ -220,8 +214,6 @@ public:
value_type const& body_;
public:
using is_deferred = std::false_type;
using const_buffers_type =
boost::asio::const_buffers_1;
@@ -844,14 +836,10 @@ public:
yield_to(
[&](yield_context yield)
{
testWriteStream<test_body<false, false, false>>(yield);
testWriteStream<test_body<false, false, true>>(yield);
testWriteStream<test_body<false, true, false>>(yield);
testWriteStream<test_body<false, true, true>>(yield);
testWriteStream<test_body< true, false, false>>(yield);
testWriteStream<test_body< true, false, true>>(yield);
testWriteStream<test_body< true, true, false>>(yield);
testWriteStream<test_body< true, true, true>>(yield);
testWriteStream<test_body<false, false>>(yield);
testWriteStream<test_body<false, true>>(yield);
testWriteStream<test_body< true, false>>(yield);
testWriteStream<test_body< true, true>>(yield);
});
}
};