Skip to content

Async<TcpListener>::accept removes interest on drop, and no poll_* based alternative #30

Closed
@Darksonn

Description

@Darksonn

The source of async-std has the following snippet:

impl<'a> Stream for Incoming<'a> {
    type Item = io::Result<TcpStream>;

    fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
        let future = self.0.accept();
        pin_utils::pin_mut!(future);

        let (socket, _) = futures_core::ready!(future.poll(cx))?;
        Poll::Ready(Some(Ok(socket)))
    }
}

link

In the latest release of async-io, the accept future was changed to release interest when the future is dropped, which breaks the above implementation. And as far as I can see, there's no poll_* based alternative for waiting for read-readiness on the Async type.

Originally reported to async-std as async-rs/async-std#888

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions