mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-07 00:00:09 +02:00
net: expose keepalive option on TcpSocket (#6311)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user