Skip to content

Commit ed1d03f

Browse files
committed
Replaces asio::post by async_immediate for immediate completions
Adds a missing include to except.hpp
1 parent 794571e commit ed1d03f

File tree

3 files changed

+14
-26
lines changed

3 files changed

+14
-26
lines changed

include/boost/http_io/detail/except.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#define BOOST_HTTP_IO_DETAIL_EXCEPT_HPP
1212

1313
#include <boost/assert/source_location.hpp>
14+
#include <boost/http_io/detail/config.hpp>
1415

1516
namespace boost {
1617
namespace http_io {

include/boost/http_io/impl/read.hpp

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
#include <boost/asio/append.hpp>
1717
#include <boost/asio/compose.hpp>
1818
#include <boost/asio/coroutine.hpp>
19-
#include <boost/asio/post.hpp>
19+
#include <boost/asio/immediate.hpp>
2020
#include <boost/assert.hpp>
21-
#include <type_traits>
2221

2322
namespace boost {
2423
namespace http_io {
@@ -57,13 +56,9 @@ class read_header_op
5756
{
5857
BOOST_ASIO_HANDLER_LOCATION((
5958
__FILE__, __LINE__,
60-
"post"));
61-
asio::post(
62-
stream_.get_executor(),
63-
asio::append(
64-
std::move(self),
65-
ec,
66-
0));
59+
"immediate"));
60+
asio::async_immediate(
61+
self.get_io_executor(), std::move(self));
6762
}
6863
goto upcall;
6964
}
@@ -145,13 +140,9 @@ class read_body_op
145140
{
146141
BOOST_ASIO_HANDLER_LOCATION((
147142
__FILE__, __LINE__,
148-
"post"));
149-
asio::post(
150-
stream_.get_executor(),
151-
asio::append(
152-
std::move(self),
153-
ec,
154-
0));
143+
"immediate"));
144+
asio::async_immediate(
145+
self.get_io_executor(), std::move(self));
155146
}
156147
goto upcall;
157148
}

include/boost/http_io/impl/write.hpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
#include <boost/asio/buffer.hpp>
1515
#include <boost/asio/compose.hpp>
1616
#include <boost/asio/coroutine.hpp>
17-
#include <boost/asio/post.hpp>
17+
#include <boost/asio/immediate.hpp>
1818
#include <boost/system/error_code.hpp>
1919
#include <boost/system/result.hpp>
20-
#include <iterator>
20+
#include <boost/http_proto/serializer.hpp>
2121

2222
namespace boost {
2323
namespace http_io {
@@ -54,8 +54,8 @@ class write_some_op
5454
void
5555
operator()(
5656
Self& self,
57-
system::error_code ec,
58-
std::size_t bytes_transferred,
57+
system::error_code ec = {},
58+
std::size_t bytes_transferred = {},
5959
bool do_post = false)
6060
{
6161
system::result<buffers_type> rv;
@@ -73,12 +73,8 @@ class write_some_op
7373
BOOST_ASIO_HANDLER_LOCATION((
7474
__FILE__, __LINE__,
7575
"http_io::write_some_op"));
76-
asio::post(
77-
dest_.get_executor(),
78-
asio::append(
79-
std::move(self),
80-
ec,
81-
bytes_transferred));
76+
asio::async_immediate(
77+
self.get_io_executor(), std::move(self));
8278
}
8379
goto upcall;
8480
}

0 commit comments

Comments
 (0)