Skip to content

Commit e05ffb6

Browse files
committed
async: Fix discarded channel input data
Channel input was inadvertently being discarded because of an incorrect refcount comparison (wrong order of operations). This would cause data to be discarded if async progress() runs before the ChanIn has consumed data. In sunsetc this never seems to occur, maybe due to specifics how the Futures are executed by embassy_futures::select? In work in progress SFTP's demo, incoming data seems to be intermittently discarded. Fixes: f06f7ce ("Move channel wakers into core sunset crate")
1 parent e2774a9 commit e05ffb6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

async/src/async_sunset.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ impl<'a, CS: CliServ> AsyncSunset<'a, CS> {
214214

215215
fn discard_channels(&self, inner: &mut Inner<CS>) -> Result<()> {
216216
if let Some((num, dt, _len)) = inner.runner.read_channel_ready() {
217-
if !self.chan_readcount(num, dt).load(Acquire) > 0 {
217+
if self.chan_readcount(num, dt).load(Acquire) == 0 {
218218
// There are no live ChanIn or ChanInOut for the num/dt,
219219
// so nothing will read the channel.
220220
// Discard the data so it doesn't block forever.

0 commit comments

Comments
 (0)