mirror of
https://github.com/boostorg/mqtt5.git
synced 2025-10-04 12:50:54 +02:00
thread-safe client
Reviewers: ivica Reviewed By: ivica Subscribers: korina Differential Revision: https://repo.mireo.local/D26864
This commit is contained in:
@@ -61,9 +61,18 @@ public:
|
||||
|
||||
template <typename Prop>
|
||||
decltype(auto) connack_prop(Prop p) {
|
||||
std::shared_lock reader_lock(_mqtt_context.ca_mtx);
|
||||
return _mqtt_context.ca_props[p];
|
||||
}
|
||||
|
||||
template <typename Prop0, typename ...Props>
|
||||
decltype(auto) connack_props(Prop0 p0, Props ...props) {
|
||||
std::shared_lock reader_lock(_mqtt_context.ca_mtx);
|
||||
return std::make_tuple(
|
||||
_mqtt_context.ca_props[p0], _mqtt_context.ca_props[props]...
|
||||
);
|
||||
}
|
||||
|
||||
void credentials(
|
||||
std::string client_id,
|
||||
std::string username = "", std::string password = ""
|
||||
@@ -109,9 +118,18 @@ public:
|
||||
|
||||
template <typename Prop>
|
||||
decltype(auto) connack_prop(Prop p) {
|
||||
std::shared_lock reader_lock(_mqtt_context.ca_mtx);
|
||||
return _mqtt_context.ca_props[p];
|
||||
}
|
||||
|
||||
template <typename Prop0, typename ...Props>
|
||||
decltype(auto) connack_props(Prop0 p0, Props ...props) {
|
||||
std::shared_lock reader_lock(_mqtt_context.ca_mtx);
|
||||
return std::make_tuple(
|
||||
_mqtt_context.ca_props[p0], _mqtt_context.ca_props[props]...
|
||||
);
|
||||
}
|
||||
|
||||
void credentials(
|
||||
std::string client_id,
|
||||
std::string username = "", std::string password = ""
|
||||
@@ -243,6 +261,11 @@ public:
|
||||
return _stream_context.connack_prop(p);
|
||||
}
|
||||
|
||||
template <typename Prop0, typename ...Props>
|
||||
decltype(auto) connack_props(Prop0 p0, Props ...props) {
|
||||
return _stream_context.connack_props(p0, props...);
|
||||
}
|
||||
|
||||
void run() {
|
||||
_stream.open();
|
||||
_rec_channel.reset();
|
||||
|
Reference in New Issue
Block a user