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: add tos and set_tos methods to TCP and UDP sockets #4366

Merged
merged 7 commits into from Dec 31, 2021

Conversation

taiki-e
Copy link
Member

@taiki-e taiki-e commented Dec 31, 2021

Closes #3545

cc #3082

The first commit is from #4361.

Refs:

@taiki-e taiki-e added A-tokio Area: The main tokio crate M-net Module: tokio/net labels Dec 31, 2021
Comment on lines 393 to 410
#[cfg(not(any(
target_os = "fuchsia",
target_os = "redox",
target_os = "solaris",
target_os = "illumos",
)))]
#[cfg_attr(
docsrs,
doc(cfg(all(
unix,
not(any(
target_os = "fuchsia",
target_os = "redox",
target_os = "solaris",
target_os = "illumos",
))
)))
)]
Copy link
Contributor

Choose a reason for hiding this comment

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

One of these includes a all(unix, ...) and the other doesn't. Why?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. I forgot to remove all(unix, ...) when I copied the doc cfg from TcpSocket::reuseport.

Comment on lines 1561 to 1563
fn to_socket(&self) -> socket2::SockRef<'_> {
socket2::SockRef::from(self)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Like I commented on the other PR, it is more idiomatic to call it as_socket.

Suggested change
fn to_socket(&self) -> socket2::SockRef<'_> {
socket2::SockRef::from(self)
}
fn as_socket(&self) -> socket2::SockRef<'_> {
socket2::SockRef::from(self)
}

Copy link
Member Author

Choose a reason for hiding this comment

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

done in fdd5865

@taiki-e taiki-e merged commit 43cdb2c into master Dec 31, 2021
@taiki-e taiki-e deleted the taiki-e/net-sock-tos branch December 31, 2021 12:19
taiki-e added a commit that referenced this pull request Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-net Module: tokio/net
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TCPStream/UDPSocket tos/set_tos methods
2 participants