Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/tcp: Add poll_accept, poll_shared_accept and poll_shutdown #533

Merged
merged 4 commits into from
Apr 26, 2024

Conversation

dignifiedquire
Copy link
Contributor

What does this PR do?

Adds

  • TcpListener::poll_accept,
  • TcpListener::poll_shared_accept and
  • TcpStream::poll_shutdown

and internally adds poll_collect_rw.

Motivation

The main methods I need right now for #531.

Copy link
Member

@HippoBaro HippoBaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small nits, otherwise I am okay to merge

Comment on lines +603 to +606
match ready!(self.stream.poll_shutdown(cx, how)) {
Ok(()) => Poll::Ready(Ok(())),
Err(err) => Poll::Ready(Err(err.into())),
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
match ready!(self.stream.poll_shutdown(cx, how)) {
Ok(()) => Poll::Ready(Ok(())),
Err(err) => Poll::Ready(Err(err.into())),
}
ready!(self.stream.poll_shutdown(cx, how)).map_err(Into::into)

Comment on lines 233 to 234
Ok(a.bind_to_executor())
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use poll_fn here like elsewhere for the sake of consistency

@HippoBaro HippoBaro force-pushed the master branch 2 times, most recently from 616409a to d480c63 Compare February 27, 2022 03:04
@pbdeuchler
Copy link

Is this PR dead? I'm in need of a non-blocking way to accept connections on a TcpListener and I believe this PR solves my problem

@vlovich
Copy link
Contributor

vlovich commented Apr 25, 2024

@glommer this seems fine to merge (I don't need it but just working through the backlog). There's an outstanding nit where the poll_shutdown isn't as absolutely concise as it could be (neither is poll_accept in my estimation), but either we can merge it or I can push a rebased PR with those nits fixed to get this closed out.

@glommer glommer merged commit 3d7f7f9 into DataDog:master Apr 26, 2024
5 checks passed
@dignifiedquire dignifiedquire deleted the net-poll branch April 26, 2024 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants