Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tcp_stream: implement keepalive/set_keepalive #3274

Closed
wants to merge 1 commit into from

Conversation

psarna
Copy link
Contributor

@psarna psarna commented Dec 14, 2020

Motivation

Setting keepalive parameters used to be possible in previous releases, and it would be nice to restore this capability. Long-standing TCP connections could benefit from having keepalive probes enabled. Example use case: scylladb/scylla-rust-driver#132

Refs #3082

Solution

A pair of keepalive()/set_keepalive() functions are implemented on top of mio's keepalive feature (added in tokio-rs/mio#1385). The interface is consistent with the one from Tokio 0.2.9. This patch comes with a simple test which verifies that previously set values are indeed saved.

In order to restore the ability to set keepalive duration
for a TCP stream, a pair of keepalive()/set_keepalive() functions
are implemented on top of mio's keepalive feature.

Refs tokio-rs#3082
@carllerche
Copy link
Member

Thanks for taking the time to submit this, we decided to punt this for now: #3146. That PR did have some notes on next steps. I would recommend opening an issue w/ a proposed API, and details on portability across platforms.

Additionally, it should be possible to set the keepalive from outside of Tokio, so you should not be blocked.

@carllerche carllerche closed this Dec 14, 2020
@Darksonn Darksonn added A-tokio Area: The main tokio crate M-net Module: tokio/net labels Dec 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-net Module: tokio/net
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants