Skip to content

Commit

Permalink
Merge branch 'subscribe_many_with_options_one' of github.com:qm3ster/…
Browse files Browse the repository at this point in the history
…paho.mqtt.rust into subscribe_many_with_options_one
  • Loading branch information
qm3ster committed Apr 23, 2021
2 parents dccde47 + befbb2a commit 9cb2eb1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/async_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -811,11 +811,17 @@ impl AsyncClient {
let n = topics.len();
// TOOD: Make sure topics & qos are same length (or use min)
let tok = Token::from_request(ServerRequest::SubscribeMany(n));
let mut rsp_opts = ResponseOptionsBuilder::new()
.token(tok.clone())
let mut rsp_opts = ResponseOptionsBuilder::new();
rsp_opts.token(tok.clone())
.subscribe_many_options(opts)
.properties(props.into().unwrap_or_default())
.finalize();
.properties(props.into().unwrap_or_default());

// This is necessary, as the `MQTTAsync_subscribeMany` paho.mqtt.c function uses `opts` over `optlist` when `count <= 1`
if let [opts] = opts {
rsp_opts.subscribe_options(*opts);
}

let mut rsp_opts = rsp_opts.finalize();

let topics = StringCollection::new(topics);

Expand Down

0 comments on commit 9cb2eb1

Please sign in to comment.