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 committed 2017-07-20 08:15:29 -07:00
1 parent bf59634bc2
commit edeb44617b
12 files changed
+24 -86

No files matched your search

+16 -16
View File
@@ -74,12 +74,10 @@ get(error_code& ec, Visit&& visit)
if(ec)
return;
auto result = rd_->get(ec);
if(ec == error::need_more)
goto go_header_only;
if(ec)
{
// Can't use need_more when ! is_deferred
BOOST_ASSERT(ec != error::need_more);
return;
}
if(! result)
goto go_header_only;
more_ = result->second;
@@ -103,10 +101,12 @@ get(error_code& ec, Visit&& visit)
break;
case do_body:
BOOST_ASSERT(! rd_);
rd_.emplace(m_, ec);
if(ec)
return;
if(! rd_)
{
rd_.emplace(m_, ec);
if(ec)
return;
}
s_ = do_body + 1;
BOOST_FALLTHROUGH;
@@ -139,12 +139,10 @@ get(error_code& ec, Visit&& visit)
if(ec)
return;
auto result = rd_->get(ec);
if(ec == error::need_more)
goto go_header_only_c;
if(ec)
{
// Can't use need_more when ! is_deferred
BOOST_ASSERT(ec != error::need_more);
return;
}
if(! result)
goto go_header_only_c;
more_ = result->second;
@@ -179,10 +177,12 @@ get(error_code& ec, Visit&& visit)
break;
case do_body_c:
BOOST_ASSERT(! rd_);
rd_.emplace(m_, ec);
if(ec)
return;
if(! rd_)
{
rd_.emplace(m_, ec);
if(ec)
return;
}
s_ = do_body_c + 1;
BOOST_FALLTHROUGH;