mqtt: Break out of receive loop on disconnect

Apparently, the `AsyncReceiver` stream produces nested `Option` objects.
The outer is `None` if "the stream is exhausted," which is somehow
different than the connection being closed; the inner `Option` is `None`
in that case.

We were originally ignoring the inner `None`, but just causes the
async task to go into a busy loop when connection is closed.  We need to
break out of the loop there instead.
dev/ci
Dustin 2023-01-07 22:22:49 -06:00
parent 94a47d863c
commit e92d8c9cef
1 changed files with 1 additions and 1 deletions

View File

@ -103,7 +103,7 @@ impl<'a> MqttClient<'a> {
client.disconnect(None); client.disconnect(None);
}); });
while let Some(msg) = self.stream.next().await { while let Some(msg) = self.stream.next().await {
let Some(msg) = msg else {continue}; let Some(msg) = msg else {break};
trace!("Received message: {:?}", msg); trace!("Received message: {:?}", msg);
for m in self.topics.matches(msg.topic()) { for m in self.topics.matches(msg.topic()) {
match m.1 { match m.1 {