Skip to content

Waker does not support Interest::WRITABLE #1336

@alexforster

Description

@alexforster

I do not believe that the removal of Registration/SetReadiness functionality in #907 can be completely replaced by Waker without the ability to signal both Interest::READABLE and Interest::WRITABLE.

Using 0.6, I was able to implement something equivalent to a Linux veth pair using two SPSC queues and the following logic–

fn update_readiness(&mut self) {
    let mut local_readiness = mio::Ready::empty();
    let mut remote_readiness = mio::Ready::empty();

    if !self.rx_buffer.is_empty() {
        local_readiness |= mio::Ready::readable();
    }
    if !self.rx_buffer.is_full() {
        remote_readiness |= mio::Ready::writable();
    }

    if !self.tx_buffer.is_full() {
        local_readiness |= mio::Ready::writable();
    }
    if !self.tx_buffer.is_empty() {
        remote_readiness |= mio::Ready::readable();
    }

    if self.local_readiness.readiness() != local_readiness {
        self.local_readiness.set_readiness(local_readiness).ok();
    }
    if self.remote_readiness.readiness() != remote_readiness {
        self.remote_readiness.set_readiness(remote_readiness).ok();
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions