Skip to content

Commit

Permalink
Filter asynchronous events (#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rantanen authored Aug 5, 2024
1 parent 35e59fa commit bf47d2b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/eventloop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,12 +441,16 @@ where
self.given = false;
}

if let Some(data) = self.receiver.get_shared_async().await {
while let Some(data) = self.receiver.get_shared_async().await {
if Some(data.source) != D::source() {
self.receiver.done();
continue;
}
self.given = true;
Ok(D::deserialize(data))
} else {
Err(EspError::from_infallible::<ESP_ERR_INVALID_STATE>())
return Ok(D::deserialize(data));
}

Err(EspError::from_infallible::<ESP_ERR_INVALID_STATE>())
}
}

Expand Down

0 comments on commit bf47d2b

Please sign in to comment.