diff --git a/src/eventloop.rs b/src/eventloop.rs index cc34efbadb8..1a3484dd7d4 100644 --- a/src/eventloop.rs +++ b/src/eventloop.rs @@ -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::()) + return Ok(D::deserialize(data)); } + + Err(EspError::from_infallible::()) } }