[rust] Fix RwHandle failing to wake current task if CLOSED was already received
Test: ran mediasession tests before and after, only after were unstuck.
Unfortunately, a repeatable testcase for this would be extremely
difficult to craft as it is tightly coupled to the async runtime and
zircon port notifications.
Change-Id: I7e3fcf1aa278d61f721d1ebf0c3fe8783fd7f3c9
diff --git a/public/rust/fuchsia-async/src/rwhandle.rs b/public/rust/fuchsia-async/src/rwhandle.rs
index ee29a8f..60772fe 100644
--- a/public/rust/fuchsia-async/src/rwhandle.rs
+++ b/public/rust/fuchsia-async/src/rwhandle.rs
@@ -156,6 +156,10 @@
if (old & READABLE) != 0 {
self.schedule_packet(zx::Signals::OBJECT_READABLE)?;
}
+ if (old & CLOSED) != 0 {
+ // We just missed a channel close-- go around again.
+ lw.wake();
+ }
Ok(())
}
@@ -172,6 +176,10 @@
if (old & WRITABLE) != 0 {
self.schedule_packet(zx::Signals::OBJECT_WRITABLE)?;
}
+ if (old & CLOSED) != 0 {
+ // We just missed a channel close-- go around again.
+ lw.wake();
+ }
Ok(())
}