tcp_stack: add keep-alive
This commit is contained in:
parent
6280e092e3
commit
242e03a8bd
|
@ -120,6 +120,8 @@ impl<'a, 'b, 'c, 'n> embedded_nal::TcpStack for NetworkStack<'a, 'b, 'c, 'n> {
|
|||
internal_socket
|
||||
.connect((address, remote.port()), self.get_ephemeral_port())
|
||||
.map_err(|_| NetworkError::ConnectionFailure)?;
|
||||
internal_socket
|
||||
.set_keep_alive(Some(net::time::Duration::from_millis(1000)));
|
||||
}
|
||||
embedded_nal::IpAddr::V6(addr) => {
|
||||
let address = {
|
||||
|
@ -132,6 +134,8 @@ impl<'a, 'b, 'c, 'n> embedded_nal::TcpStack for NetworkStack<'a, 'b, 'c, 'n> {
|
|||
internal_socket
|
||||
.connect((address, remote.port()), self.get_ephemeral_port())
|
||||
.map_err(|_| NetworkError::ConnectionFailure)?;
|
||||
internal_socket
|
||||
.set_keep_alive(Some(net::time::Duration::from_millis(1000)));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue