Skip to content

Commit

Permalink
net: expose keepalive option on TcpSocket (#6311)
Browse files Browse the repository at this point in the history
  • Loading branch information
maminrayej committed Jan 30, 2024
1 parent 131e7b4 commit 9077762
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tokio/src/net/tcp/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,16 @@ impl TcpSocket {
Ok(TcpSocket { inner })
}

/// Sets value for the `SO_KEEPALIVE` option on this socket.
pub fn set_keepalive(&self, keepalive: bool) -> io::Result<()> {
self.inner.set_keepalive(keepalive)
}

/// Gets the value of the `SO_KEEPALIVE` option on this socket.
pub fn keepalive(&self) -> io::Result<bool> {
self.inner.keepalive()
}

/// Allows the socket to bind to an in-use address.
///
/// Behavior is platform specific. Refer to the target platform's
Expand Down

0 comments on commit 9077762

Please sign in to comment.