Skip to content

Commit a9ef08c

Browse files
authored
Merge pull request #439 from redboltz/fix_438
2 parents 2c3cacc + 9503d83 commit a9ef08c

9 files changed

Lines changed: 205 additions & 185 deletions

File tree

CHANGELOG.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
= History
44

5+
== 10.2.7
6+
* Removed unintentional copy requiment from some of async functions parameter. #437
7+
* Rifined documents. #435
8+
* Added TLS Websocket verify none port to broker for browser. #434
9+
* Added Cerfiticate file's digitalSignature to keyUsage. #432
10+
511
== 10.2.6
612
* Fixed wss connection from Web Browser handshake failed problem. #431
713
* Changed trial broker on `mqtt.redboltz.net` ws and wss port. #430

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
- I/O independent (also known as Sans-I/O) MQTT protocol library for C++17.
44
- Asynchronous MQTT communication library using the MQTT protocol library and Boost.Asio.
55

6-
Version 10.2.6 [![Actions Status](https://github.com/redboltz/async_mqtt/workflows/CI/badge.svg)](https://github.com/redboltz/async_mqtt/actions)[![codecov](https://codecov.io/gh/redboltz/async_mqtt/branch/main/graph/badge.svg)](https://codecov.io/gh/redboltz/async_mqtt)
6+
Version 10.2.7 [![Actions Status](https://github.com/redboltz/async_mqtt/workflows/CI/badge.svg)](https://github.com/redboltz/async_mqtt/actions)[![codecov](https://codecov.io/gh/redboltz/async_mqtt/branch/main/graph/badge.svg)](https://codecov.io/gh/redboltz/async_mqtt)
77

88
## Document
99

include/async_mqtt/asio_bind/impl/client_auth.hpp

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -88,37 +88,39 @@ client<Version, NextLayer>::async_auth(Args&&... args) {
8888
}
8989
}
9090
else {
91-
auto all = hana::tuple<Args...>(std::forward<Args>(args)...);
92-
auto back = hana::back(all);
93-
auto rest = hana::drop_back(all, hana::size_c<1>);
94-
return hana::unpack(
95-
std::move(rest),
96-
[&](auto&&... rest_args) {
97-
static_assert(
98-
std::is_constructible_v<
99-
auth_packet,
100-
decltype(rest_args)...
101-
>,
102-
"v5::auth_packet is not constructible"
103-
);
104-
try {
105-
return impl_type::async_auth(
106-
impl_,
107-
error_code{},
108-
auth_packet{std::forward<decltype(rest_args)>(rest_args)...},
109-
force_move(back)
110-
);
111-
}
112-
catch (system_error const& se) {
113-
return impl_type::async_auth(
114-
impl_,
115-
se.code(),
116-
std::nullopt,
117-
force_move(back)
91+
return [this](auto&&... all_args) {
92+
auto all = hana::make_tuple(std::forward<decltype(all_args)>(all_args)...);
93+
constexpr auto N = sizeof...(all_args);
94+
auto back = hana::at_c<N - 1>(force_move(all));
95+
return hana::unpack(
96+
hana::drop_back(force_move(all), hana::size_c<1>),
97+
[this, back = force_move(back)](auto&&... rest_args) mutable {
98+
static_assert(
99+
std::is_constructible_v<
100+
auth_packet,
101+
decltype(rest_args)...
102+
>,
103+
"v5::auth_packet is not constructible"
118104
);
105+
try {
106+
return impl_type::async_auth(
107+
impl_,
108+
error_code{},
109+
auth_packet{std::forward<decltype(rest_args)>(rest_args)...},
110+
force_move(back)
111+
);
112+
}
113+
catch (system_error const& se) {
114+
return impl_type::async_auth(
115+
impl_,
116+
se.code(),
117+
std::nullopt,
118+
force_move(back)
119+
);
120+
}
119121
}
120-
}
121-
);
122+
);
123+
}(std::forward<Args>(args)...);
122124
}
123125
}
124126

include/async_mqtt/asio_bind/impl/client_disconnect.hpp

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -87,37 +87,39 @@ client<Version, NextLayer>::async_disconnect(Args&&... args) {
8787
}
8888
}
8989
else {
90-
auto all = hana::tuple<Args...>(std::forward<Args>(args)...);
91-
auto back = hana::back(all);
92-
auto rest = hana::drop_back(all, hana::size_c<1>);
93-
return hana::unpack(
94-
std::move(rest),
95-
[&](auto&&... rest_args) {
96-
static_assert(
97-
std::is_constructible_v<
98-
disconnect_packet,
99-
decltype(rest_args)...
100-
>,
101-
"disconnect_packet is not constructible"
102-
);
103-
try {
104-
return impl_type::async_disconnect(
105-
impl_,
106-
error_code{},
107-
disconnect_packet{std::forward<decltype(rest_args)>(rest_args)...},
108-
force_move(back)
109-
);
110-
}
111-
catch (system_error const& se) {
112-
return impl_type::async_disconnect(
113-
impl_,
114-
se.code(),
115-
std::nullopt,
116-
force_move(back)
90+
return [this](auto&&... all_args) {
91+
auto all = hana::make_tuple(std::forward<decltype(all_args)>(all_args)...);
92+
constexpr auto N = sizeof...(all_args);
93+
auto back = hana::at_c<N - 1>(force_move(all));
94+
return hana::unpack(
95+
hana::drop_back(force_move(all), hana::size_c<1>),
96+
[this, back = force_move(back)](auto&&... rest_args) mutable {
97+
static_assert(
98+
std::is_constructible_v<
99+
disconnect_packet,
100+
decltype(rest_args)...
101+
>,
102+
"disconnect_packet is not constructible"
117103
);
104+
try {
105+
return impl_type::async_disconnect(
106+
impl_,
107+
error_code{},
108+
disconnect_packet{std::forward<decltype(rest_args)>(rest_args)...},
109+
force_move(back)
110+
);
111+
}
112+
catch (system_error const& se) {
113+
return impl_type::async_disconnect(
114+
impl_,
115+
se.code(),
116+
std::nullopt,
117+
force_move(back)
118+
);
119+
}
118120
}
119-
}
120-
);
121+
);
122+
}(std::forward<Args>(args)...);
121123
}
122124
}
123125

include/async_mqtt/asio_bind/impl/client_publish.hpp

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -87,37 +87,39 @@ client<Version, NextLayer>::async_publish(Args&&... args) {
8787
}
8888
}
8989
else {
90-
auto all = hana::tuple<Args...>(std::forward<Args>(args)...);
91-
auto back = hana::back(all);
92-
auto rest = hana::drop_back(all, hana::size_c<1>);
93-
return hana::unpack(
94-
std::move(rest),
95-
[&](auto&&... rest_args) {
96-
static_assert(
97-
std::is_constructible_v<
98-
publish_packet,
99-
decltype(rest_args)...
100-
>,
101-
"publish_packet is not constructible"
102-
);
103-
try {
104-
return impl_type::async_publish(
105-
impl_,
106-
error_code{},
107-
publish_packet{std::forward<decltype(rest_args)>(rest_args)...},
108-
force_move(back)
109-
);
110-
}
111-
catch (system_error const& se) {
112-
return impl_type::async_publish(
113-
impl_,
114-
se.code(),
115-
std::nullopt,
116-
force_move(back)
90+
return [this](auto&&... all_args) {
91+
auto all = hana::make_tuple(std::forward<decltype(all_args)>(all_args)...);
92+
constexpr auto N = sizeof...(all_args);
93+
auto back = hana::at_c<N - 1>(force_move(all));
94+
return hana::unpack(
95+
hana::drop_back(force_move(all), hana::size_c<1>),
96+
[this, back = force_move(back)](auto&&... rest_args) mutable {
97+
static_assert(
98+
std::is_constructible_v<
99+
publish_packet,
100+
decltype(rest_args)...
101+
>,
102+
"publish_packet is not constructible"
117103
);
104+
try {
105+
return impl_type::async_publish(
106+
impl_,
107+
error_code{},
108+
publish_packet{std::forward<decltype(rest_args)>(rest_args)...},
109+
force_move(back)
110+
);
111+
}
112+
catch (system_error const& se) {
113+
return impl_type::async_publish(
114+
impl_,
115+
se.code(),
116+
std::nullopt,
117+
force_move(back)
118+
);
119+
}
118120
}
119-
}
120-
);
121+
);
122+
}(std::forward<Args>(args)...);
121123
}
122124
}
123125

include/async_mqtt/asio_bind/impl/client_start.hpp

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -89,39 +89,41 @@ client<Version, NextLayer>::async_start(Args&&... args) {
8989
}
9090
}
9191
else {
92-
auto all = hana::tuple<Args...>(std::forward<Args>(args)...);
93-
auto back = hana::back(all);
94-
auto rest = hana::drop_back(all, hana::size_c<1>);
95-
return hana::unpack(
96-
std::move(rest),
97-
[&](auto&&... rest_args) {
98-
static_assert(
99-
std::is_constructible_v<
100-
connect_packet,
101-
decltype(rest_args)...
102-
>,
103-
"connect_packet is not constructible"
104-
);
105-
try {
106-
return impl_type::async_start(
107-
impl_,
108-
error_code{},
109-
connect_packet{
110-
std::forward<std::remove_reference_t<decltype(rest_args)>>(rest_args)...
111-
},
112-
force_move(back)
113-
);
114-
}
115-
catch (system_error const& se) {
116-
return impl_type::async_start(
117-
impl_,
118-
se.code(),
119-
std::nullopt,
120-
force_move(back)
92+
return [this](auto&&... all_args) {
93+
auto all = hana::make_tuple(std::forward<decltype(all_args)>(all_args)...);
94+
constexpr auto N = sizeof...(all_args);
95+
auto back = hana::at_c<N - 1>(force_move(all));
96+
return hana::unpack(
97+
hana::drop_back(force_move(all), hana::size_c<1>),
98+
[this, back = force_move(back)](auto&&... rest_args) mutable {
99+
static_assert(
100+
std::is_constructible_v<
101+
connect_packet,
102+
decltype(rest_args)...
103+
>,
104+
"connect_packet is not constructible"
121105
);
106+
try {
107+
return impl_type::async_start(
108+
impl_,
109+
error_code{},
110+
connect_packet{
111+
std::forward<std::remove_reference_t<decltype(rest_args)>>(rest_args)...
112+
},
113+
force_move(back)
114+
);
115+
}
116+
catch (system_error const& se) {
117+
return impl_type::async_start(
118+
impl_,
119+
se.code(),
120+
std::nullopt,
121+
force_move(back)
122+
);
123+
}
122124
}
123-
}
124-
);
125+
);
126+
}(std::forward<Args>(args)...);
125127
}
126128
}
127129

include/async_mqtt/asio_bind/impl/client_subscribe.hpp

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -87,37 +87,39 @@ client<Version, NextLayer>::async_subscribe(Args&&... args) {
8787
}
8888
}
8989
else {
90-
auto all = hana::tuple<Args...>(std::forward<Args>(args)...);
91-
auto back = hana::back(all);
92-
auto rest = hana::drop_back(all, hana::size_c<1>);
93-
return hana::unpack(
94-
std::move(rest),
95-
[&](auto&&... rest_args) {
96-
static_assert(
97-
std::is_constructible_v<
98-
subscribe_packet,
99-
decltype(rest_args)...
100-
>,
101-
"subscribe_packet is not constructible"
102-
);
103-
try {
104-
return impl_type::async_subscribe(
105-
impl_,
106-
error_code{},
107-
subscribe_packet{std::forward<decltype(rest_args)>(rest_args)...},
108-
force_move(back)
109-
);
110-
}
111-
catch (system_error const& se) {
112-
return impl_type::async_subscribe(
113-
impl_,
114-
se.code(),
115-
std::nullopt,
116-
force_move(back)
90+
return [this](auto&&... all_args) {
91+
auto all = hana::make_tuple(std::forward<decltype(all_args)>(all_args)...);
92+
constexpr auto N = sizeof...(all_args);
93+
auto back = hana::at_c<N - 1>(force_move(all));
94+
return hana::unpack(
95+
hana::drop_back(force_move(all), hana::size_c<1>),
96+
[this, back = force_move(back)](auto&&... rest_args) mutable {
97+
static_assert(
98+
std::is_constructible_v<
99+
subscribe_packet,
100+
decltype(rest_args)...
101+
>,
102+
"subscribe_packet is not constructible"
117103
);
104+
try {
105+
return impl_type::async_subscribe(
106+
impl_,
107+
error_code{},
108+
subscribe_packet{std::forward<decltype(rest_args)>(rest_args)...},
109+
force_move(back)
110+
);
111+
}
112+
catch (system_error const& se) {
113+
return impl_type::async_subscribe(
114+
impl_,
115+
se.code(),
116+
std::nullopt,
117+
force_move(back)
118+
);
119+
}
118120
}
119-
}
120-
);
121+
);
122+
}(std::forward<Args>(args)...);
121123
}
122124
}
123125

0 commit comments

Comments
 (0)