Skip to content

Commit 19db5ec

Browse files
committed
[FOLD]
1 parent 0f0b98e commit 19db5ec

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

include/boost/ws_io/client.hpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020
namespace boost {
2121
namespace ws_io {
2222

23+
struct null_decorator
24+
{
25+
void operator()(...) const noexcept
26+
{
27+
}
28+
};
29+
2330
/** A websocket client session
2431
*/
2532
template<
@@ -41,16 +48,19 @@ class client
4148
BOOST_ASIO_COMPLETION_TOKEN_FOR(void(
4249
::boost::beast::error_code,
4350
::boost::http_proto::response_view)) HandshakeHandler =
44-
asio::default_completion_token_t<executor_type>
51+
asio::default_completion_token_t<executor_type>,
52+
class Decorator = null_decorator
4553
>
4654
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(HandshakeHandler, void(
4755
::boost::beast::error_code,
4856
::boost::http_proto::response_view))
4957
async_handshake(
5058
core::string_view host,
5159
core::string_view target,
60+
Decorator decorator = {},
5261
HandshakeHandler&& handler =
53-
asio::default_completion_token_t<executor_type>{});
62+
asio::default_completion_token_t<executor_type>{}
63+
);
5464

5565
AsyncStream&
5666
next_layer() noexcept

include/boost/ws_io/impl/client.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,16 @@ template<class AsyncStream>
9494
template<
9595
BOOST_ASIO_COMPLETION_TOKEN_FOR(void(
9696
::boost::beast::error_code,
97-
::boost::http_proto::response_view)) HandshakeHandler>
97+
::boost::http_proto::response_view)) HandshakeHandler,
98+
class Decorator>
9899
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(HandshakeHandler, void(
99100
::boost::beast::error_code,
100101
::boost::http_proto::response_view))
101102
client<AsyncStream>::
102103
async_handshake(
103104
core::string_view host,
104105
core::string_view target,
106+
Decorator decorator,
105107
HandshakeHandler&& handler)
106108
{
107109
return asio::async_initiate<

test/unit/client.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ struct client_test
3131
cs.async_handshake(
3232
"localhost",
3333
"/",
34+
[](http_proto::request&)
35+
{
36+
},
3437
test::success_handler());
35-
srv.run();
38+
//srv.run();
3639
}
3740
};
3841

0 commit comments

Comments
 (0)