Skip to content

Commit 8a3a543

Browse files
PR feedback
1 parent 695c73a commit 8a3a543

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

library/std/src/net/tcp/tests.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,8 +834,7 @@ fn test_timeout_zero_duration() {
834834
fn linger() {
835835
let addr = next_test_ip4();
836836
let _listener = t!(TcpListener::bind(&addr));
837-
838-
let stream = t!(TcpStream::connect(&("localhost", addr.port())));
837+
let stream = t!(TcpStream::connect(&addr));
839838

840839
assert_eq!(None, t!(stream.linger()));
841840
t!(stream.set_linger(Some(Duration::from_secs(1))));

library/std/src/sys/net/connection/socket/hermit.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,11 @@ impl Socket {
273273
}
274274

275275
pub fn set_keepalive(&self, keepalive: bool) -> io::Result<()> {
276-
let value: i32 = if keepalive { 1 } else { 0 };
277-
unsafe { setsockopt(self, netc::SOL_SOCKET, netc::SO_KEEPALIVE, value) }
276+
unsafe { setsockopt(self, netc::SOL_SOCKET, netc::SO_KEEPALIVE, keepalive as c_int) }
278277
}
279278

280279
pub fn keepalive(&self) -> io::Result<bool> {
281-
let raw: i32 = unsafe { getsockopt(self, netc::SOL_SOCKET, netc::SO_KEEPALIVE)? };
280+
let raw: c_int = unsafe { getsockopt(self, netc::SOL_SOCKET, netc::SO_KEEPALIVE)? };
282281
Ok(raw != 0)
283282
}
284283

0 commit comments

Comments
 (0)