|
23 | 23 | //! broker to emit the LWT message. |
24 | 24 |
|
25 | 25 | /******************************************************************************* |
26 | | - * Copyright (c) 2017-2023 Frank Pagliughi <[email protected]> |
| 26 | + * Copyright (c) 2017-2025 Frank Pagliughi <[email protected]> |
27 | 27 | * |
28 | 28 | * All rights reserved. This program and the accompanying materials |
29 | 29 | * are made available under the terms of the Eclipse Public License v2.0 |
|
38 | 38 | * Frank Pagliughi - initial implementation and documentation |
39 | 39 | *******************************************************************************/ |
40 | 40 |
|
41 | | -use futures::{executor::block_on, stream::StreamExt}; |
| 41 | +use futures::executor::block_on; |
42 | 42 | use paho_mqtt::{self as mqtt, MQTT_VERSION_5}; |
43 | 43 | use std::{env, process, time::Duration}; |
44 | 44 |
|
@@ -79,7 +79,7 @@ fn main() { |
79 | 79 |
|
80 | 80 | if let Err(err) = block_on(async { |
81 | 81 | // Get message stream before connecting. |
82 | | - let mut strm = cli.get_stream(25); |
| 82 | + let strm = cli.get_stream(25); |
83 | 83 |
|
84 | 84 | // Define the set of options for the connection |
85 | 85 | let lwt = mqtt::Message::new( |
@@ -114,7 +114,7 @@ fn main() { |
114 | 114 | // whatever) the server will get an unexpected drop and then |
115 | 115 | // should emit the LWT message. |
116 | 116 |
|
117 | | - while let Some(msg_opt) = strm.next().await { |
| 117 | + while let Ok(msg_opt) = strm.recv().await { |
118 | 118 | if let Some(msg) = msg_opt { |
119 | 119 | if msg.retained() { |
120 | 120 | print!("(R) "); |
|
0 commit comments