Skip to content

Commit

Permalink
Some other defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
benashford committed Feb 12, 2024
1 parent fc61e8a commit 245cc34
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/client/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ pub async fn connect_tls(host: &str, port: u16) -> Result<RespConnection, error:
error::ConnectionReason::ConnectionFailed,
))?;
let tcp_stream = TcpStream::connect(addr).await?;
apply_keepalive(&tcp_stream, DEFAULT_KEEPALIVE_DURATION)?;

let stream = connector
.connect(
Expand Down Expand Up @@ -227,7 +228,8 @@ fn apply_keepalive(stream: &TcpStream, interval: Duration) -> Result<(), error::

let keep_alive = socket2::TcpKeepalive::new()
.with_time(interval)
.with_interval(interval);
.with_interval(interval)
.with_retries(1);

sock_ref.set_tcp_keepalive(&keep_alive)?;

Expand Down

0 comments on commit 245cc34

Please sign in to comment.