ockam icon indicating copy to clipboard operation
ockam copied to clipboard

added Tcp keepalive & removed Tcp heartbeat

Open phillyphil91 opened this issue 2 years ago • 1 comments

Current Behavior

Current implementations of TCP clients need to rely on ad-hoc heartbeats in order to keep the TCP connection open.

Proposed Changes

Enable tcp_keepalive for the TcpStream through the socket2 crate and remove usage of custom heartbeat. This addresses: https://github.com/build-trust/ockam/issues/3450 and possibly https://github.com/build-trust/ockam/issues/3480

Checks

phillyphil91 avatar Sep 18 '22 15:09 phillyphil91

The current changes "should" enable tcp keepalive for the TcpStream. Maybe it makes sense to add a test for this? On the other hand the only change is turning on tcp keepalive, so maybe that should already be tested by the socket2 crate. Also I wasn't sure if the place where I instantiated the socket2::TcpKeepalive is the best one or if that should happen in the calling function async fn process in listener.rs or some other place.

I forgot to add my new key to git before the commit so the first commit is not verified. I'm not sure if I can fix this now. I can also add my name to the CONTRIBUTORS.csv file if this PR is merged.

phillyphil91 avatar Sep 18 '22 15:09 phillyphil91

Since today is the last day of hacktoberfest, I've add the hacktoberfest-accepted label in case you're participating. We can merge the PR after the current on going discussion is resolved.

mrinalwadhwa avatar Oct 30 '22 14:10 mrinalwadhwa

Hey @phillyphil91 , very nice job! Could you please resolve my latest comments and do a rebase? Also, could you please update Cargo.lock and squash your changes into 1 commit that follows the Ockam commit message convention? That is required to pass CI checks

SanjoDeundiak avatar Oct 31 '22 12:10 SanjoDeundiak

@phillyphil91 could you please sign the Ockam Contributor License Agreement by adding my Git/Github details in a row at the end of the CONTRIBUTORS.csv file in a separate pull request to the build-trust/ockam-contributors repository.

SanjoDeundiak avatar Oct 31 '22 17:10 SanjoDeundiak

@SanjoDeundiak done

phillyphil91 avatar Nov 01 '22 13:11 phillyphil91

@phillyphil91 congratulations on an amazing first contribution 🥳🥳🥳🥳

mrinalwadhwa avatar Nov 01 '22 15:11 mrinalwadhwa

@mrinalwadhwa thanks. great experience. hopefully more to come

phillyphil91 avatar Nov 01 '22 15:11 phillyphil91