Fix the poll of channel according to gvisor pipe poll test

This commit is contained in:
He Sun 2021-01-22 00:16:21 +08:00 committed by Zongmin.Gu
parent 2ea7fc1ad6
commit 1788f94bfe
3 changed files with 5 additions and 5 deletions

@ -2,6 +2,6 @@
[![codecov](https://codecov.io/gh/occlum/occlum/branch/master/graph/badge.svg?token=FS22ULGGRC)](https://codecov.io/gh/occlum/occlum)
Occlum are written in different languages. Only *Rust* code coverage is enabled,
Occlum is written in different languages. Only *Rust* code coverage is enabled,
currently. Besides, the coverage data is only collected during `make test` and
`make test-glibc`. Adding more tests will improve the coverage data.

@ -247,7 +247,7 @@ impl<I> Producer<I> {
let writable = {
let mut rb_producer = self.inner.lock().unwrap();
!rb_producer.is_full() || self.is_self_shutdown() || self.is_peer_shutdown()
!rb_producer.is_full() || self.is_self_shutdown()
};
if writable {
events |= IoEvents::OUT;
@ -373,7 +373,7 @@ impl<I> Consumer<I> {
let readable = {
let mut rb_consumer = self.inner.lock().unwrap();
!rb_consumer.is_empty() || self.is_self_shutdown() || self.is_peer_shutdown()
!rb_consumer.is_empty() || self.is_self_shutdown()
};
if readable {
events |= IoEvents::IN;

@ -109,9 +109,9 @@ impl Inner {
let writer_events = self.writer.poll();
if reader_events.contains(IoEvents::HUP) || self.reader.is_self_shutdown() {
events |= IoEvents::RDHUP;
events |= IoEvents::RDHUP | IoEvents::IN;
if writer_events.contains(IoEvents::ERR) || self.writer.is_self_shutdown() {
events |= IoEvents::HUP;
events |= IoEvents::HUP | IoEvents::OUT;
}
}