BodyReader, BodyWriter use two-phase init (API Change):

These types now perform error-based initialization in
a separate init() functions instead of in the constructor.

Actions Required:

* Modify instances of user-defined BodyReader and BodyWriter
  types to perfrom two-phase initialization, as per the
  updated documented type requirements.
This commit is contained in:
Vinnie Falco
2017-07-20 08:15:30 -07:00
parent 8a3df73ffc
commit e06a055503
19 changed files with 325 additions and 146 deletions
+22 -7
View File
@@ -47,13 +47,18 @@ public:
template<bool isRequest, class Allocator>
explicit
reader(message<isRequest, unsized_body,
Allocator> const& msg, error_code &ec)
reader(message<isRequest,
unsized_body, Allocator> const& msg)
: body_(msg.body)
{
}
void
init(error_code& ec)
{
ec.assign(0, ec.category());
}
boost::optional<std::pair<const_buffers_type, bool>>
get(error_code& ec)
{
@@ -87,9 +92,14 @@ public:
template<bool isRequest, class Fields>
explicit
reader(message<isRequest, test_body,
Fields> const& msg, error_code& ec)
reader(message<isRequest,
test_body, Fields> const& msg)
: body_(msg.body)
{
}
void
init(error_code& ec)
{
ec.assign(0, ec.category());
}
@@ -219,9 +229,14 @@ public:
template<bool isRequest, class Allocator>
explicit
reader(message<isRequest, fail_body,
Allocator> const& msg, error_code& ec)
reader(message<isRequest,
fail_body, Allocator> const& msg)
: body_(msg.body)
{
}
void
init(error_code& ec)
{
body_.fc_.fail(ec);
}