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

std: Store flowinfo/scope_id in host byte order #32429

Merged
merged 1 commit into from
Mar 23, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/libstd/net/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ impl SocketAddrV6 {
sin6_family: c::AF_INET6 as c::sa_family_t,
sin6_port: hton(port),
sin6_addr: *ip.as_inner(),
sin6_flowinfo: hton(flowinfo),
sin6_scope_id: hton(scope_id),
sin6_flowinfo: flowinfo,
sin6_scope_id: scope_id,
.. unsafe { mem::zeroed() }
},
}
Expand Down Expand Up @@ -173,23 +173,23 @@ impl SocketAddrV6 {
/// Returns the flow information associated with this address,
/// corresponding to the `sin6_flowinfo` field in C.
#[stable(feature = "rust1", since = "1.0.0")]
pub fn flowinfo(&self) -> u32 { ntoh(self.inner.sin6_flowinfo) }
pub fn flowinfo(&self) -> u32 { self.inner.sin6_flowinfo }

/// Change the flow information associated with this socket address.
#[unstable(feature = "sockaddr_setters", reason = "recent addition", issue = "31572")]
pub fn set_flowinfo(&mut self, new_flowinfo: u32) {
self.inner.sin6_flowinfo = hton(new_flowinfo)
self.inner.sin6_flowinfo = new_flowinfo;
}

/// Returns the scope ID associated with this address,
/// corresponding to the `sin6_scope_id` field in C.
#[stable(feature = "rust1", since = "1.0.0")]
pub fn scope_id(&self) -> u32 { ntoh(self.inner.sin6_scope_id) }
pub fn scope_id(&self) -> u32 { self.inner.sin6_scope_id }

/// Change the scope ID associated with this socket address.
#[unstable(feature = "sockaddr_setters", reason = "recent addition", issue = "31572")]
pub fn set_scope_id(&mut self, new_scope_id: u32) {
self.inner.sin6_scope_id = hton(new_scope_id)
self.inner.sin6_scope_id = new_scope_id;
}
}

Expand Down